USB drive loses space - Mandriva

This is a discussion on USB drive loses space - Mandriva ; Mandriva 2006, with a 120GB maxtor on a usb as sda5. I've been moving files between a Win XP machine and the Linux box. In the process, perhaps by deleting files on the USB drive from XP, it seems the ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: USB drive loses space

  1. USB drive loses space

    Mandriva 2006, with a 120GB maxtor on a usb as sda5.

    I've been moving files between a Win XP machine and the
    Linux box. In the process, perhaps by deleting files
    on the USB drive from XP, it seems the USB disk space
    is not recovered or seen as free by the Linux system.

    df
    /dev/sda5 115G 114G 851M 100% /mnt/USB_MAXTOR

    XP
    USB_MAXTOR 114G free space 15.1G

    I believe the system is Fat-32 on the USB drive.

    fsck provides little I can recognize;

    [..]# fsck /mnt/USB_MAXTOR/
    fsck 1.38 (30-Jun-2005)
    e2fsck 1.38 (30-Jun-2005)
    fsck.ext2: Is a directory while trying to open /mnt/USB_MAXTOR/

    The superblock could not be read or does not describe a correct ext2
    filesystem. If the device is valid and it really contains an ext2
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193


    So at this point I'm uncertain how to procede.

    Any suggestions or comments that might help me in
    straightening out this USB drive, much appreciated.



  2. Re: USB drive loses space

    On Sat, 18 Aug 2007 13:29:49 -0400, Adam wrote:

    > Mandriva 2006, with a 120GB maxtor on a usb as sda5.


    sda is a device. sda5 is the first extended partition
    on that device.

    fdisk -l (as root) will show you how large linux thinks
    the device is, as well as the partitions allocated,
    their size, and type.

    > df
    > /dev/sda5 115G 114G 851M 100% /mnt/USB_MAXTOR
    > XP
    > USB_MAXTOR 114G free space 15.1G


    I suspect XP is not showing some files, such as hidden
    system files, or possibly the recycle bin. I haven't
    tested this, so this is just speculation.

    > I believe the system is Fat-32 on the USB drive.
    > [..]# fsck /mnt/USB_MAXTOR/


    Do not run fsck on a mounted filesystem.

    unmount /dev/sda5
    dosfsck -Vv /dev/sda5

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  3. Re: USB drive loses space

    David W. Hodgins wrote:

    > fdisk -l (as root) will show you how large linux thinks
    > the device is, as well as the partitions allocated,
    > their size, and type.


    Disk /dev/sda: 122.9 GB, 122942324736 bytes
    255 heads, 63 sectors/track, 14946 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 2 14946 120045712+ f W95 Ext'd (LBA)
    /dev/sda5 2 14946 120045681 b W95 FAT32


    > Do not run fsck on a mounted filesystem.
    >
    > unmount /dev/sda5
    > dosfsck -Vv /dev/sda5


    dosfsck is what I was looking for. So umounted and
    when running - a curly question about which of the
    two FATs to use. I imagine its the second one, and
    need to look up what the f and b IDs are.




    [...]# dosfsck -Vv /dev/sda5
    dosfsck 2.10 (22 Sep 2003)
    dosfsck 2.10, 22 Sep 2003, FAT32, LFN
    Checking we can access the last sector of the filesystem
    There are differences between boot sector and its backup.
    Differences: (offsetriginal/backup)
    65:01/00
    1) Copy original to backup
    2) Copy backup to original
    3) No action
    ? 3
    Boot sector contents:
    System ID "MSWIN4.1"
    Media byte 0xf8 (hard disk)
    512 bytes per logical sector
    32768 bytes per cluster
    32 reserved sectors
    First FAT starts at byte 16384 (sector 32)
    2 FATs, 32 bit entries
    15002112 bytes per FAT (= 29301 sectors)
    Root directory start at cluster 2 (arbitrary size)
    Data area starts at byte 30020608 (sector 58634)
    3750511 data clusters (122896744448 bytes)
    63 sectors/track, 255 heads
    16128 hidden sectors
    240091362 sectors total
    Starting check/repair pass.
    FATs differ but appear to be intact. Use which FAT ?
    1) Use first FAT
    2) Use second FAT
    ? c-c

    [...]#








  4. Re: USB drive loses space

    On Sat, 18 Aug 2007 14:31:19 -0400, Adam wrote:

    > Device Boot Start End Blocks Id System
    > /dev/sda1 2 14946 120045712+ f W95 Ext'd (LBA)
    > /dev/sda5 2 14946 120045681 b W95 FAT32
    > FATs differ but appear to be intact. Use which FAT ?


    The master boot record (mbr) contains a partition table, with room
    for four entries.

    /dev/sda1, type f, is an entry in the partition table in the mbr 1st
    table entry, in this case. It simply points to a sector where the
    first extended partition table exists. The first extended partition
    table (not shown by fdisk), has an entry for the first (and in
    this case only) extended partition, /dev/sda5.

    Fat32, normally has 2 copies of the fat (file allocation table), which
    has one entry per cluster, for data space on the filesystem. The directory
    has an entry for each file, specifying the first entry in the fat, for
    that file. Within the fat, each entry for a file, points to the next
    entry in the fat, except for the last entry, for a file, which
    will be set to zero.

    Having the two tables be different, indicates to me, that the
    drive was disconnected, without having had the cache written to
    the disk, for example, by selecting the "safely remove hardware" icon
    in the system tray under xp, or by unmounting the device, under linux.

    Not good.

    I'd use the xp system to run a full scan (scandisk, or chkdsk), the
    drive, just to be on the safe side. Make sure you always use the
    "safely remove hardware" icon, or shutdown windows, before disconnecting
    the device. Under linux, either umount the filesystem, or halt the
    system, before disconnecting.

    Fixing errors in the scan, will probably create a bunch of file????.chk
    files in the root directory, where ???? will be replace by a number.
    Each of those files will correspond to files that have been deleted,
    based on the directory entries, but which are still consuming space,
    according to the fat.

    Look at the contents of each of those files, and either rename it,
    or delete it.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  5. Re: USB drive loses space


    Thanks Dave.




  6. Re: USB drive loses space

    I stopped #dosfsck -Vv /dev/sda5 after several days.

    #dosfsck -atv /dev/sda5 seems to take a long time too,
    and is still running. The first -Vv seems to have found
    and fixed something. Am yet to re-mount and look at.



  7. Re: USB drive loses space

    On Wed, 22 Aug 2007 20:18:29 -0400, Adam wrote:

    > I stopped #dosfsck -Vv /dev/sda5 after several days.
    > #dosfsck -atv /dev/sda5 seems to take a long time too,
    > and is still running. The first -Vv seems to have found
    > and fixed something. Am yet to re-mount and look at.


    Try a straight dosfsck -v. Ie. Without the second path. Even with
    123 GB, I wouldn't expect it to take days.

    What about scandisk/chkdsk under xp. How long does that take?

    I gather you were successfull in fixing the problems with the differences
    bewteen the two copies of the fat. Are xp and linux now reporting approximately the same amount of free space?

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  8. Re: USB drive loses space


    Ultimately chkdsk /f under XP seems to have fixed the
    problem. Now the free space is the same between Linux
    and XP. I even did a defrag also, to force the issue.

    This was a USB drive with Win98 drivers under old
    W98 system on my P2 - now replaced with Mdrva 2006.
    So don't think there's a 'safely remove USB' util
    for Mdva 2006, or maybe its not necessary there.

    I have found the 'safely remove USB' button down
    there hidden in the bottom right of XP - and will
    religiously use from here on.

    And backed up that USB stuff anyway.

    I can see that dd'ing the 2 FATs might be an option.
    But in the meantime will read man doschk, as I'm
    obviously not up to speed with that.


    Thanks again Dave.

    There's another USB issue, but for another day.



  9. Re: USB drive loses space

    On Fri, 24 Aug 2007 15:12:54 -0400, Adam wrote:

    > Ultimately chkdsk /f under XP seems to have fixed the
    > problem. Now the free space is the same between Linux


    Good.

    > So don't think there's a 'safely remove USB' util
    > for Mdva 2006, or maybe its not necessary there.


    In linux, unmount the drive, before disconneting.

    > I have found the 'safely remove USB' button down
    > there hidden in the bottom right of XP - and will
    > religiously use from here on.


    That should fix the cause of the problem. Thanks
    for updating the thread.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

+ Reply to Thread