Find the answer to your Linux question:
Results 1 to 7 of 7
I am using an external hard drive (an apple ipod) and I am confident that there is 41G space left on it. That is also what du tells me: Code: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    5

    df is wrong for mounted device


    I am using an external hard drive (an apple ipod) and I am confident that there is 41G space left on it. That is also what du tells me:
    Code:
    ~> du --max-depth=0 /mnt/ipod/
    42319056        /mnt/ipod/
    However, df reports that it is almost full:
    Code:
    ~> df /mnt/ipod/
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sdb2             77973488  77797872    175616 100% /mnt/ipod
    And indeed I am told that I'm out of space when I try to copy large files.

    I believe that df is wrong. But what is causing the problem and how do I correct it?

    Thanks a lot,

    Dan

    p.s. I have previously seen this sort of thing being caused by files stored below the mountpoint, that are "hidden" by the mounted device. However, when I unmount the device, there is nothing stored at /mnt/ipod
    Code:
    ~> umount /mnt/ipod
    ~> du /mnt/ipod/
    4       /mnt/ipod/

  2. #2
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9
    Please paste here output of this command:
    mount -l
    (this will show options for all mounded file systems).

    I also suggest to use:
    du -sh /mnt/ipod/
    instead of
    du --max-depth=0 /mnt/ipod/

    and

    df -h /mnt/ipod
    instead of
    df /mnt/ipod

  3. #3
    Just Joined!
    Join Date
    Mar 2007
    Posts
    5
    Thanks artemn, here goes:

    First this seems to show a clear inconsistency between du and df:

    Code:
    ~> du -sh /mnt/ipod/
    41G     /mnt/ipod/
    
    ~> df -h /mnt/ipod
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sdb2              75G   75G   14M 100% /mnt/ipod
    And here's the output of mount -l:

    Code:
    ~> mount -l
    /dev/sda3 on / type ext3 (rw) [/]
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/mapper/vg00-lvhome on /home type ext3 (rw)
    /dev/mapper/vg00-lvtmp on /tmp type ext3 (rw)
    /dev/mapper/vg00-lvusr on /usr type ext3 (rw)
    /dev/mapper/vg00-lvvar on /var type ext3 (rw)
    /dev/sda2 on /mnt/shared type vfat (rw,uid=502,gid=502)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    automount(pid2521) on /net type autofs (rw,fd=4,pgrp=2521,minproto=2,maxproto=4)
    /dev/sdb2 on /mnt/ipod type vfat (rw,noexec,nosuid,nodev,user=dan) [IPOD]
    /dev/sdc1 on /mnt/xd type vfat (rw) [DSK2_VOL1]

  4. #4
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9
    Hmm...

    Maybe it makes sense to back up data and perform:
    fsck -t vfat /mnt/ipod

    By the way, here is discussion of similar problem for XFS filesystem:
    du vs. df inconsistency

  5. #5
    Just Joined!
    Join Date
    Mar 2007
    Posts
    5
    artemn suggested
    Maybe it makes sense to back up data and perform:
    fsck -t vfat /mnt/ipod
    I did that (output below), but the problem seems to persist, even though I selected the option to correct something that fsck thought was wrong.

    (EDIT: I just checked under Windows, which reported the correct situation: 41G used, 34G available.)

    Code:
    /home/dan# fsck -V -t vfat /mnt/ipod ; echo exit code is $?     
    fsck 1.38 (30-Jun-2005)
    [/sbin/fsck.vfat (1) -- /mnt/ipod] fsck.vfat /dev/sdb2 
    dosfsck 2.11, 12 Mar 2005, FAT32, LFN
    Free cluster summary wrong (846 vs. really 2218272)
    1) Correct
    2) Don't correct
    ? 1
    Leaving file system unchanged.
    /dev/sdb2: 8126 files, 2655071/4873343 clusters
    exit code is 1
    
    /home/dan# umount /mnt/ipod/
    /home/dan# mount /mnt/ipod/
    /home/dan# df -h /mnt/ipod/
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sdb2              75G   75G   14M 100% /mnt/ipod
    /home/dan# du -sh /mnt/ipod/
    41G     /mnt/ipod/

  6. #6
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9
    Look at these lines:
    Code:
    Free cluster summary wrong (846 vs. really 2218272)
    and
    Code:
    Leaving file system unchanged.
    It seems it's necessary to start fsck with autorepair option:
    Code:
    fsck -a -V -t vfat /mnt/ipod

  7. #7
    Just Joined!
    Join Date
    Mar 2007
    Posts
    5
    Thanks for that. I noticed that fsck had refused my request to repair, but I didn't know hot to use the autorepair option.

    However, in the end I gave up and reformatted the disk (following the instructions at IpodConversionToFAT32 < Main < TWiki), and I think it's OK now.

    Thanks again for the help.

Posting Permissions

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