Find the answer to your Linux question:
Results 1 to 3 of 3
I want to find the amount of free space in the / partition in my machine. i am using the following two commands for the same . 1. du -h ...
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    20

    Talking disk usage in a partition



    I want to find the amount of free space in the / partition in my machine.
    i am using the following two commands for the same .
    1. du -h
    2. df -h

    but i am getting different disk usage figures.

    The df -h command states i have only used 4.7G of space :


    [root@nnii0232 /]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda3 38G 4.7G 32G 13% /
    /dev/sda2 190M 9.9M 171M 6% /boot
    tmpfs 1009M 0 1009M 0% /dev/shm
    /dev/sda5 15G 5.9G 7.7G 44% /ora10gas

    when i use du -h /

    0 /sys/devices/platform/i8042/serio1/power
    0 /sys/devices/platform/i8042/serio1
    0 /sys/devices/platform/i8042/serio0/id
    0 /sys/devices/platform/i8042/serio0/power
    0 /sys/devices/platform/i8042/serio0
    0 /sys/devices/platform/i8042/power
    0 /sys/devices/platform/i8042
    0 /sys/devices/platform/serial8250/power
    0 /sys/devices/platform/serial8250
    0 /sys/devices/platform/pcspkr/power
    0 /sys/devices/platform/pcspkr
    0 /sys/devices/platform/power
    0 /sys/devices/platform
    0 /sys/devices
    0 /sys/fs/fscache
    0 /sys/fs
    0 /sys
    11G /


    it states i have used 11GB space . Why is this difference between the two commands.

    pl help me with this.
    Thanks in advance .

    Anshul

  2. #2
    Trusted Penguin Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,318
    'df' will tell you how much space your partitions are using. 'du' scans the filesystem to tell you how much space is used, so if you have any other partitions mounted under /, it'll include those too.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Jan 2008
    Posts
    20

    Thumbs up

    thanks ..this helped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •