EzDevInfo.com

disk-usage interview questions

Top disk-usage frequently asked interview questions

Why doesn't this show the hidden files/folders?

I was looking through my system with du -sch ./* to find the big useless files I may have stockpiled with no reason, when I found this:

$ du -sch ./*
du: cannot read directory ‘./drbunsen/.gvfs’: Permission denied
du: cannot read directory ‘./drbunsen/.cache/dconf’: Permission denied
18G ./drbunsen
18G total

$ cd drbunsen/
$ du -sch ./*
601M ./Desktop
20K ./Documents
598M ./Downloads
4.0K ./flash
4.0K ./Music
8.0M ./Pictures
4.0K ./Public
4.0K ./Templates
4.0K ./Ubuntu One
8.0K ./Videos
11G ./VirtualBox VMs
6.9M ./workspace
12G total

How do I make hidden files visible? du -sch ./.* gives the same result as du -sch ./*.


Source: (StackOverflow)

How do I free up more space in /boot?

My /boot partition is nearly full and I get a warning every time I reboot my system. I already deleted old kernel packages (linux-headers...), actually I did that to install a newer kernel version that came with the automatic updates. After installing that new version, the partition is nearly full again. So what else can I delete? Are there some other files associated to the old kernel images?

Here is a list of files that are on my /boot partition:

:~$ ls /boot/
abi-2.6.31-21-generic         lost+found
abi-2.6.32-25-generic         memtest86+.bin
abi-2.6.38-10-generic         memtest86+_multiboot.bin
abi-2.6.38-11-generic         System.map-2.6.31-21-generic
abi-2.6.38-12-generic         System.map-2.6.32-25-generic
abi-2.6.38-8-generic          System.map-2.6.38-10-generic
abi-3.0.0-12-generic          System.map-2.6.38-11-generic
abi-3.0.0-13-generic          System.map-2.6.38-12-generic
abi-3.0.0-14-generic          System.map-2.6.38-8-generic
boot                          System.map-3.0.0-12-generic
config-2.6.31-21-generic      System.map-3.0.0-13-generic
config-2.6.32-25-generic      System.map-3.0.0-14-generic
config-2.6.38-10-generic      vmcoreinfo-2.6.31-21-generic
config-2.6.38-11-generic      vmcoreinfo-2.6.32-25-generic
config-2.6.38-12-generic      vmcoreinfo-2.6.38-10-generic
config-2.6.38-8-generic       vmcoreinfo-2.6.38-11-generic
config-3.0.0-12-generic       vmcoreinfo-2.6.38-12-generic
config-3.0.0-13-generic       vmcoreinfo-2.6.38-8-generic
config-3.0.0-14-generic       vmcoreinfo-3.0.0-12-generic
extlinux                      vmcoreinfo-3.0.0-13-generic
grub                          vmcoreinfo-3.0.0-14-generic
initrd.img-2.6.31-21-generic  vmlinuz-2.6.31-21-generic
initrd.img-2.6.32-25-generic  vmlinuz-2.6.32-25-generic
initrd.img-2.6.38-10-generic  vmlinuz-2.6.38-10-generic
initrd.img-2.6.38-11-generic  vmlinuz-2.6.38-11-generic
initrd.img-2.6.38-12-generic  vmlinuz-2.6.38-12-generic
initrd.img-2.6.38-8-generic   vmlinuz-2.6.38-8-generic
initrd.img-3.0.0-12-generic   vmlinuz-3.0.0-12-generic
initrd.img-3.0.0-13-generic   vmlinuz-3.0.0-13-generic
initrd.img-3.0.0-14-generic   vmlinuz-3.0.0-14-generic

Currently, I'm using the 3.0.0-14-generic kernel.


Source: (StackOverflow)

Advertisements

How do I find the amount of free space on my hard drive?

Is there a way to quickly check the amount of free / used disk space in Ubuntu?

I would assume you could right click on 'file system' in the file browser and choose 'properties' or something but there is no such option.


Source: (StackOverflow)

What's a command line way to find large files/directories to remove and free up space?

Looking for a series of commands that will show me the largest files on a drive.


Source: (StackOverflow)

How to get disk usage from command line?

How can I get the current disk usage (in %) of my hard drive from the command line?


Source: (StackOverflow)

Meaning of "i" in "MiB"?

I see the usage of "MiB" as measure to represent the size in Ubuntu. What does MiB stand for? In particular the "i"?


Source: (StackOverflow)

Can't upgrade due to low disk space on /boot

I try to do do-release-upgrade but then I get:

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 25.7 M free space on disk '/boot'. Please free at least an additional 25.7 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.

Output of df:

                    237251272 214797108  10402504  96% /
udev                    488120         4    488116   1% /dev
tmpfs                   198676       668    198008   1% /run
none                      5120         0      5120   0% /run/lock
none                    496684         0    496684   0% /run/shm
/dev/sda1               233191    225867         0 100% /boot

How come there is no space left on boot? Here's the output of ls -as /boot:

total 221839
    4 .
    4 ..
  645 abi-2.6.32-34-generic-pae
  698 abi-2.6.35-30-generic-pae
  727 abi-2.6.38-12-generic-pae
  727 abi-3.0.0-12-generic-pae
  727 abi-3.0.0-13-generic-pae
  727 abi-3.0.0-14-generic-pae
  727 abi-3.0.0-15-generic-pae
  727 abi-3.0.0-16-generic-pae
  727 abi-3.0.0-17-generic-pae
  727 abi-3.0.0-19-generic-pae
  761 abi-3.0.0-20-generic-pae
  115 config-2.6.32-34-generic-pae
  128 config-2.6.35-30-generic-pae
  136 config-2.6.38-12-generic-pae
  140 config-3.0.0-12-generic-pae
  140 config-3.0.0-13-generic-pae
  140 config-3.0.0-14-generic-pae
  140 config-3.0.0-15-generic-pae
  140 config-3.0.0-16-generic-pae
  140 config-3.0.0-17-generic-pae
  140 config-3.0.0-19-generic-pae
  140 config-3.0.0-20-generic-pae
    5 grub
10773 initrd.img-2.6.32-34-generic-pae
13619 initrd.img-2.6.35-30-generic-pae
15365 initrd.img-2.6.38-12-generic-pae
16481 initrd.img-3.0.0-12-generic-pae
16487 initrd.img-3.0.0-13-generic-pae
16501 initrd.img-3.0.0-14-generic-pae
16476 initrd.img-3.0.0-15-generic-pae
16481 initrd.img-3.0.0-16-generic-pae
16478 initrd.img-3.0.0-17-generic-pae
   12 lost+found
  174 memtest86+.bin
  176 memtest86+_multiboot.bin
 1700 System.map-2.6.32-34-generic-pae
 1841 System.map-2.6.35-30-generic-pae
 2115 System.map-2.6.38-12-generic-pae
 2141 System.map-3.0.0-12-generic-pae
 2141 System.map-3.0.0-13-generic-pae
 2143 System.map-3.0.0-14-generic-pae
 2146 System.map-3.0.0-15-generic-pae
 2147 System.map-3.0.0-16-generic-pae
 2147 System.map-3.0.0-17-generic-pae
 2148 System.map-3.0.0-19-generic-pae
 2149 System.map-3.0.0-20-generic-pae
    2 vmcoreinfo-2.6.32-34-generic-pae
    2 vmcoreinfo-2.6.35-30-generic-pae
    2 vmcoreinfo-2.6.38-12-generic-pae
    2 vmcoreinfo-3.0.0-12-generic-pae
    2 vmcoreinfo-3.0.0-13-generic-pae
    2 vmcoreinfo-3.0.0-14-generic-pae
    2 vmcoreinfo-3.0.0-15-generic-pae
    2 vmcoreinfo-3.0.0-16-generic-pae
    2 vmcoreinfo-3.0.0-17-generic-pae
    2 vmcoreinfo-3.0.0-19-generic-pae
    2 vmcoreinfo-3.0.0-20-generic-pae
 4092 vmlinuz-2.6.32-34-generic-pae
 4347 vmlinuz-2.6.35-30-generic-pae
 4567 vmlinuz-2.6.38-12-generic-pae
 4675 vmlinuz-3.0.0-12-generic-pae
 4676 vmlinuz-3.0.0-13-generic-pae
 4681 vmlinuz-3.0.0-14-generic-pae
 4698 vmlinuz-3.0.0-15-generic-pae
 4700 vmlinuz-3.0.0-16-generic-pae
 4700 vmlinuz-3.0.0-17-generic-pae
 4703 vmlinuz-3.0.0-19-generic-pae
 4705 vmlinuz-3.0.0-20-generic-pae

Output of uname -a:

 Linux kitsch 3.0.0-17-generic-pae #30-Ubuntu SMP Thu Mar 8 17:53:35 UTC 2012 i686 i686 i386 GNU/Linux

Source: (StackOverflow)

How can I check disk space used in a partition using the terminal in Ubuntu 12.04 LTS? [duplicate]

This question already has an answer here:

I am using Ubuntu 12.04 LTS and I was wondering if there is a command that can tell the space used in a partition using the terminal. Like I want to use the su command to change to a user called admin (it is named admin). So I typed :

su admin

Entered the password

Now I want to see the disk space used in this partition. So.... Is there is a command fot that?


Source: (StackOverflow)

How can I quickly make a large file?

What is a quick and easy way to make a file that is, say, 2 GB in size?


Source: (StackOverflow)

apt-get: No space left on device (12.04)

I have read every thread I could find -- even the ones that say that the question has been answered elsewhere but none of them address the specific issue I am having. Update Manager ran and produced errors relating to unmet dependency and suggested using apt-get install -f which fails with this message:

Unpacking linux-headers-3.5.0-36 (from .../linux-headers-3.5.0-36_3.5.0-36.57~precise1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.5.0-36_3.5.0-36.57~precise1_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-3.5.0-36/arch/arm/mach-iop32x/include/mach/glantank.h.dpkg-new' (while processing `./usr/src/linux-headers-3.5.0-36/arch/arm/mach-iop32x/include/mach/glantank.h'): No space left on device

I suspect that the last 5 words No space left on device are significant but df and du both show adequate space. So I am wondering, what device needs more space?

Ouput from df -h

Filesystem 
Size Used Avail Use% 
Mounted on /dev/sda1 5.5G 4.4G 786M 86% 
/ udev 996M 4.0K 996M 1% 
/dev tmpfs 402M 880K 401M 1% 
/run none 5.0M 0 5.0M 0% /run/lock none 1004M 156K 1004M 1% 
/run/shm /dev/sdb1 30G 1.4G 27G 5% 
/home /dev/sdc1 299G 31G 268G 11% /media/HD-PCTU2 

Source: (StackOverflow)

Deleting contents of ~/.local/share/Trash/expunged .....?

Is there a safe way of deleting contents of ~/.local/share/Trash/expunged ? I see It has lots of files & folders I had deleted -- from the trash as well. They are taking a lot of disc space.

After deleting the files & clearing the trash why are the files still there ?

I haven't tried it yet but is it ok to manually delete them ?

  sudo rm -rv ~/.local/share/Trash/expunged

Source: (StackOverflow)

Check how space is distributed on Linux system

I know how to check space left with:

df -h

and I know to check the space of a folder with:

du -ch /path/to/folder/

But let's say I have a 500 GB HardDisk and 350GB are used:

  • Wich is the best tool/command to get how the space is distributed ?

  • Should I do du -ch / ? (I think this is not optimal)

  • There is any special tool/app to do this ?

I'd like an app that stores how the space is distributed in my system, wich are the space occuped in each folder...

I'd like to have something like SpaceSniffer (You can check the windows tool here). It is a Windows program that examine your HardDisk and show in a easy & nice IU how the space is distributed on your computer

This kind of software is awesome for that day you check your HardDisk and it seems you've "lost" hundred of GB's and don't know where they are !


Edit

  • I've tried baobab and runs/works perfectly in my Ubuntu machine, I tested also JDiskReport, here I have to fix some issues but it works in Ubuntu & Windows

  • I assume JDiskReport will work in any  OS with Java installed, that's why I choose as correct answer. I've tried this in Ubuntu, Windows 8, Raspbian and CentOS and works in all of them (you have to install Java)

  • I have to say for those lovers of command-line your choice should be ncdu, it's awesome !!!

Baobab IU:

This is the baobab IU


Source: (StackOverflow)

How do I resize my /boot partition?

/boot has become 100% full somehow.

df -k
Filesystem              1K-blocks     Used Available Use% Mounted on
/dev/mapper/ubuntu-root 191078052 31758960 149612804  18% /
udev                      3997520        8   3997512   1% /dev
tmpfs                     1602244      856   1601388   1% /run
none                         5120        0      5120   0% /run/lock
none                      4005600     1792   4003808   1% /run/shm
none                       102400       28    102372   1% /run/user
/dev/sda1                  233191   218740      2010 100% /boot


mount
/dev/mapper/ubuntu-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
/dev/sda1 on /boot type ext2 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
gvfsd-fuse on /run/user/foo/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=foo)

How can I make the space allocated to /boot bigger?

There is a related question How do I free up more space in /boot? but that is not what I want to do.

Added.

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders, total 390721968 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007f9dc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   390721535   195109889    5  Extended
/dev/sda5          501760   390721535   195109888   8e  Linux LVM

Disk /dev/mapper/ubuntu-root: 198.8 GB, 198784843776 bytes
255 heads, 63 sectors/track, 24167 cylinders, total 388251648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu-swap_1: 1006 MB, 1006632960 bytes
255 heads, 63 sectors/track, 122 cylinders, total 1966080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu-swap_1 doesn't contain a valid partition table

Source: (StackOverflow)

Why doesn't deleting files increase available space?

Recently I got a message about "0 bytes free" on a certain partition.

So I looked and, sure enough:

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1       65190604  10920296  50959160  18% /
udev              966544         4    966540   1% /dev
tmpfs             389532       744    388788   1% /run
none                5120         0      5120   0% /run/lock
none              973828       152    973676   1% /run/shm
/dev/sda5      397327316 391010276         0 100% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

there are 0 bytes available on that partition.

So I deleted a bunch of files I didn't need on this machine, and emptied the trash. I expected the "Used" to get smaller and the "Available" to get larger by the same amount.

But what actually happened was

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1       65190604  10921184  50958272  18% /
udev              966544         4    966540   1% /dev
tmpfs             389532       744    388788   1% /run
none                5120         0      5120   0% /run/lock
none              973828       152    973676   1% /run/shm
/dev/sda5      397327316 390986836         0 100% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

the "Used" actually did get smaller, but the "Available" is still zero.

I rebooted the machine, and I still see 0 in the "Available" column.

Why is "Available" always zero, even when I delete a bunch of files so "Used" gets smaller?

Why doesn't deleting files increase available space?

I am running Ubuntu 12.04 LTS.

$ df -hi
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda1        4.0M  512K  3.5M   13% /
udev             205K   486  204K    1% /dev
tmpfs            208K   390  208K    1% /run
none             208K     3  208K    1% /run/lock
none             208K     7  208K    1% /run/shm
/dev/sda5         25M  975K   24M    4% /media/8b5e40d0-95b3-4e60-831c-e9b9aeadbfa4

Source: (StackOverflow)

How to find out how much disk space is remaining?

What is the command to find out how much disk space is being used/remaining?


Source: (StackOverflow)