Questions tagged [disk-usage]
Disk space usage: how much space do my files take?
1,133
questions
1650
votes
16
answers
3.6m
views
How do I get the size of a directory on the command line?
I tried to obtain the size of a directory (containing directories and sub directories) by using the ls command with option l. It seems to work for files (ls -l file name), but if I try to get the size ...
816
votes
40
answers
975k
views
Tracking down where disk space has gone on Linux?
When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time ...
290
votes
18
answers
322k
views
How do you sort du output by size?
How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong.
[~]# du -sh /var/* | sort -n
0 /var/mail
1.2M /...
254
votes
14
answers
512k
views
How to recursively find the amount stored in directory?
I know you are able to see the byte size of a file when you do a long listing with ll or ls -l. But I want to know how much storage is in a directory including the files within that directory and the ...
184
votes
3
answers
520k
views
Finding all large files in the root filesystem
I have a linux server, which currently has below space usage:
/dev/sda3 20G 15G 4.2G 78% /
/dev/sda6 68G 42G 23G 65% /u01
/dev/sda2 30G 7.4G 21G 27%...
168
votes
4
answers
385k
views
Find and remove large files that are open but have been deleted
How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open?
The situation is that we are running a ...
147
votes
9
answers
151k
views
Which installed software packages use the most disk space on Debian?
Disk space on my root partition is running low, so I want to delete some applications from the system. How can I see which software packages use the most disk space? Is it possible to view that from ...
139
votes
4
answers
16k
views
Why are there so many different ways to measure disk usage?
When I sum up the sizes of my files, I get one figure. If I run du, I get another figure. If I run du on all the files on my partition, it doesn't match what df claims is used. Why are there so many ...
137
votes
7
answers
302k
views
Using --exclude with the du command
This is probably something basic but I'm not able to make it work. I'm trying to use DU to get a total size of files minus certain directories. I need to exclude one specific directory called uploads ...
127
votes
4
answers
150k
views
Reserved space for root on a filesystem - why?
I understand that by default, newly created filesystems will be created with 5% of the space allocated for root. I also know you can change the defined space with:
tune2fs -m 1 /dev/sdXY
What I'm ...
120
votes
14
answers
136k
views
How to understand what's taking up disk space?
I'm looking for a linux alternative to WinDirStat. I would like to know what is taking up space on my hard drives.
A program that works on console and doesn't require a UI is preferred .
105
votes
12
answers
232k
views
How do I count all the files recursively through directories
I want to see how many files are in subdirectories to find out where all the inode usage is on the system. Kind of like I would do this for space usage
du -sh /*
which will give me the space used in ...
99
votes
4
answers
122k
views
Print size of directory content with tree command in tree 1.5?
I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not the cumulative size of its contents.
/media/
├── [ 16K]...
87
votes
4
answers
36k
views
What does size of a directory mean in output of 'ls -l' command?
What does size of a directory mean in output of ls -l command?
86
votes
6
answers
93k
views
Getting size with du of files only
How can I get the size of all files and all files in its subdirectories using the du command.
I am trying the following command to get the size of all files (and files in subdirectories)
find . -...
76
votes
7
answers
259k
views
Tell fs to free space from deleted files NOW
Is there a way to tell the kernel to give back the free disk space now? Like a write to something in /proc/ ? Using Ubuntu 11.10 with ext4.
This is probably an old and very repeated theme.
After ...
71
votes
7
answers
65k
views
Fedora 23 -- Can I safely delete files in /var/cache/PackageKit/metadata/updates/packages?
I noticed that the folder referenced in the subject line is taking up 1.5 GB. Can I run the below to clear it without causing permanent damage to my system?
rm -rf /var/cache/PackageKit/metadata/...
70
votes
11
answers
317k
views
Finding files that use the most disk space
Is it possible to list the largest files on my hard drive? I frequently use df -H to display my disk usage, but this only gives the percentage full, GBs remaining, etc.
I do a lot of data-intensive ...
66
votes
4
answers
65k
views
Way to instantly fill up/use up lots of disk space?
On a Linux VM I would like to TEST the NAGIOS monitoring more deeply than just switching off the VM or disconnecting the virtual NIC; I would like to test or "enforce a disk space alarm" through ...
60
votes
8
answers
65k
views
How to cache or otherwise speed up `du` summaries?
We have a large file system on which a full du (disk usage) summary takes over two minutes. I'd like to find a way to speed up a disk usage summary for arbitrary directories on that file system.
For ...
60
votes
2
answers
131k
views
df vs. du: why so much difference? [duplicate]
Possible Duplicate:
Why is there a discrepancy in disk usage reported by df and du?
df says 8.9G used by the partition mounted in /
:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/...
57
votes
3
answers
23k
views
Why is a text file taking up at least 4kB even when there's just one byte of text in it?
For some reason, when I make a text file on OS X, it's always at least 4kB, unless it's blank. Why is this? Could there be 4,000 bytes of metadata about 1 byte of plain text?
55
votes
6
answers
89k
views
Sort all directories based on their size
I'd like to sort all the directories/files in a specific directory based on their size (using du -sh "name").
I need to apply this command to all directories in my location, then sort them based on ...
51
votes
2
answers
66k
views
How to remember the difference between du and df?
du and df do rather similar things, and so I always find myself typing the wrong one.
I think if I knew what "du" and "df" stands for it might make it easier to remember which to use.
What is a way ...
48
votes
2
answers
117k
views
How do I get the total size of everything in a directory in one line? [duplicate]
I know I can use du -h to output the total size of a directory. But when it contains other subdirectories, the output would be something like:
du -h /root/test
.
.
.
.
24K /root/test/1
64K /root/...
41
votes
10
answers
143k
views
Why is 'df' hanging?
I have recently been having problems running df, where it just hangs. Here's strace output, and in it, you'll see that I killed since it was just sitting there:
$ strace /bin/df
execve("/bin/df", ["/...
40
votes
5
answers
50k
views
mount info for current directory
I can do df . to get some of the info on the mount that the current directory is in, and I can get all the info I want from mount. However, I get too much info (info about other mounts). I can grep it ...
37
votes
6
answers
39k
views
combine the best of 'du' and 'tree'
I'm wondering if we can combine the honesty of 'du' with the indented formatting of 'tree'. If I want a listing of the sizes of directories:
du -hx -d2
...displays two levels deep and all the size ...
36
votes
4
answers
152k
views
How to find free disk space and analyze disk usage? [duplicate]
In CentOS and Ubuntu, how do I find out how much free disk space I have left and other disk stats like disk usage?
35
votes
5
answers
13k
views
Can I run out of disk space by creating a very large number of empty files?
It is well-known that empty text files have zero bytes:
However, each of them contains metadata, which according to my research, is stored in inodes, and do use space.
Given this, it seems logical ...
34
votes
3
answers
46k
views
du gives two different results for the same file
I am a graduate student of computational chemistry with access to a Linux cluster. The cluster consists of a very large (25 TB) fileserver, to which several dozen compute nodes are connected. Each ...
33
votes
9
answers
145k
views
How to fix "E: You don't have enough free space in /var/cache/apt/archives/."
E: You don't have enough free space in /var/cache/apt/archives/.
root@kali:~# df -H
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 406M 7....
31
votes
5
answers
48k
views
How do I compress files in-place?
I have a machine with 90% hard-disk usage. I want to compress its 500+ log files into a smaller new file. However, the hard disk is too small to keep both the original files and the compressed ones.
...
31
votes
1
answer
67k
views
snap /dev/loop at 100% utilization -- no free space
Free space:
thufir@dur:~$
thufir@dur:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 794M ...
30
votes
10
answers
19k
views
show only physical disks when using df and mount
When I use df or mount, I'm most of all interested in physical disk partitions. Nowadays the output of those commands is overwhelmed by temporary and virtual filesystems, cgroups and other things I am ...
30
votes
2
answers
27k
views
Why do hard links seem to take the same space as the originals?
Thanks to some good Q&A around here and this page, I now understand links. I see hard links refer the same inode by a different name, and copies are different "nodes, with different names. Plus ...
29
votes
4
answers
13k
views
Why df and Finder shows different available disk space?
In home directory, df -h $HOME shows
Filesystem Size Used Avail Use% Mounted on
/dev/disk1 231G 177G 54G 77% /
But in finder
Any ideas?
EDIT
Attached df -h output
/dev/disk1 ...
28
votes
2
answers
34k
views
How can I find the number of files on a filesystem?
I want to know how many files I have on my filesystem. I know I can do something like this:
find / -type f | wc -l
This seems highly inefficient. What I'd really like is to do is find the total ...
28
votes
3
answers
58k
views
Why does fstab use UUID instead of the actual file system name?
For example, this is the first line of my /etc/fstab:
UUID=050e1e34-39e6-4072-a03e-ae0bf90ba13a / ext4 errors=remount-ro 0 1
And here's the output of df -h command (reporting free ...
27
votes
6
answers
23k
views
How can I determine if running tar will cause disk to fill up
If I run tar -cvf on a directory of size 937MB to create an easily downloadable copy of a deeply nested folder structure, do I risk filling the disk given the following df -h output:
/dev/xvda1 ...
26
votes
11
answers
44k
views
My hard disk is full - how can I determine what's taking up space? [duplicate]
I have 20GB for my Mint-KDE 18 root partition. There is no extra home partition. I am doing nothing special, just Chrome, KRDC, Teamviewer and the partition was half empty. One thing I did was copying ...
26
votes
5
answers
24k
views
How to get folder size ignoring hard links?
I use rsnapshot for backups, which generates a series of folders containing files of the same name. Some of the files are hard linked, while others are separate. For instance, hourly.1/file1 and ...
26
votes
4
answers
54k
views
Why are partition size and df output different?
I have a partition /dev/sda1.
Disk utility shows it has the capacity of 154 GB.
df -h shows
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 123G 104G 14G 89% /
...
26
votes
9
answers
18k
views
Is there a way of deleting duplicates more refined than fdupes -rdN?
Recently I have the need to delete a lot of duplicates. I am merging three or four filesystems, and I want the space to be used economically. At first, fdupes seemed like it was the best tool for the ...
25
votes
1
answer
58k
views
Updating disk free size without rebooting the host
I use RHEL4 with LVM2 on it. At times even after removing large files more than a GB, the partition size is not getting updated when using the df command.
-bash-3.00$ df -h
Filesystem Size ...
25
votes
2
answers
19k
views
Is it safe to empty /usr/share/doc?
I don't need the manpages and documentations on my debian server. Is it save to empty that folder completely to free up some disk-space, by replacing all files in that folder with empty dummy files.
...
24
votes
5
answers
3k
views
How to strip a Linux system?
I've been building a Linux distro, and I've stripped the binaries, etc. The system won't use GCC or development tools, as it will be a Chrome kiosk, so it would greatly help if I could strip down the ...
23
votes
2
answers
5k
views
How do I compile something for Linux if I don't have enough space for installing GCC?
I purchased a Human Machine Interface (Exor Esmart04). Running on Linux 3.10.12, however this Linux is stripped down and does not have a C compiler. Another problem is the disk space:
I've tried to ...