Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Short of fdisk, how can I delete a corrupt file?

  • 20-04-2005 12:33AM
    #1
    Closed Accounts Posts: 4,763 ✭✭✭


    I was copying some files to my pendrive this morning, but they wound up corrupt after I unplugged it accidently. Now I can't delete them from the drive. Under Windows (tried 2k+XP), it simply says the drive isn't accesible. Under Linux, I get an I/O error:
    [root@fenster flash]# rm -Rf clamav-devel/
    rm: cannot remove `clamav-devel//bin/tomasz k.ojm': Read-only file system
    rm: cannot remove `clamav-devel//bin/home pag.e :': Read-only file system
    rm: cannot remove `clamav-devel//bin/5288 279.d': Read-only file system
    rm: cannot lstat `clamav-devel//bin/44b\r\npro.jec': Input/output error
    


Comments

  • Registered Users, Registered Users 2 Posts: 4,081 ✭✭✭Nukem


    Right Click Pen Drive - Properties - tools - Error Checking.......... Back up

    Might be worth a shot.

    Nukem


  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    Occasionally I get problems like that. By the way, it might be an idea to rmmod usb-ehci - it knocks you down to USB1, but I find that my computer likes me more that way (i.e. doesn't crash in the middle of a big file transfer), especially if you're using an old kernel.

    Anyway, back to the problem at hand: At times like these I really find that fsck.msdos is my friend. Don't mount the drive, but just fsck the drive. Then, when you're fairly confident, try 'fsck.msdos -a /dev/sda' or wherever your drive lives. -a will automatically repair it... there's another option that needs to be put in there but I can't remember it (as with any filesystem tool - familiarise yourself with its man page until it's like that sibling, of indeterminate sex, you never had). It fixed mine up a treat!

    You should be able to mount the filesystem in rw mode again then.

    Hope that helps,
    Phantom Beaker


  • Closed Accounts Posts: 4,763 ✭✭✭Fenster


    Hah, fsck choked on it.
    [root@fenster ~]# fsck.msdos -a /dev/sda1
    dosfsck 2.8, 28 Feb 2001, FAT32, LFN
    Warning: FAT32 support is still ALPHA.
    There are differences between boot sector and its backup.
    Differences: (offset:original/backup)
      65:01/00
      Not automatically fixing this.
    /clamav-devel/BIN
      Has a large number of bad entries. (47/128)
      Not dropping it in auto-mode.
    /clamav-devel/BIN
      "." is missing. Can't fix this yet.
    /clamav-devel/BIN
      ".." is missing. Can't fix this yet.
    Long filename fragment ":0ys:FEt:1ID:8C-:07A:7o0:30a:7SG:8iq:2HC:3bS:7DW:8j9" found outside a LFN sequence.
      (Maybe the start bit is missing on the last fragment)
      Not auto-correcting this.
    Checksum in long filename part wrong (fa vs. expected ff).
      Not auto-correcting this.
    Segmentation fault
    

    I'll boot into Windows in a bit and try chkdsk on it

    EDIT: Aye, chkdsk sorted it.


Advertisement
Advertisement