[HOWTO] Repair a corrupted flashdrive (w/linux filesystem)

Post tutorials, HOWTO's and other useful resources here.
User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

[HOWTO] Repair a corrupted flashdrive (w/linux filesystem)

Post#1 by Ahau » 07 Jan 2011, 15:19

Many thanks to fanthom, who walked me through this process!

**Please note, this is only for those working in a linux filesystem, such as ext2 or ext3, not for FAT filesystems**

After upgrading from 32-bit to 64-bit Porteus on my ext3 usb drive, I was having a number of issues with KDE stalling during startup. It turns out that I had a corrupted filesystem -- which I figured out because I could not delete one of my files, receiving the error:

rm: cannot remove `ld.so.cache': Input/output error

Here are the steps I followed in order to remove the corrupted file. I also had a number of other problems with my filesystem, which this process repaired.

1) Try booting into Porteus on the device that is corrupted. Press TAB when the boot menu comes up, which will allow you to modify the cheatcodes.

2) Remove the cheatcode that starts with 'changes=', and then add the cheatcodes 'noauto' and 'copy2ram' (without the quotes, separated by a space), and press enter to startup KDE. It is important that you not run fsck on a mounted partition, these cheatcodes will allow you to start KDE without mounting the device from which you are booting.

3) You're going to run fsck (file system check) on the corrupted device. Open a terminal, type fsck, then press TAB twice. This shows you all of the options for fsck, and you'll choose the correct option for your filesystem. For example, my drive was formatted in ext3, so I used fsck.ext3.

4) After you've hit TAB twice, bash leaves fsck on the command line, so you'll just need to enter the appropriate option, then enter the location of the corrupted partition, e.g.:

Code: Select all

fsck.ext3 /dev/sdb1
Press Enter, and the specified partition will be checked for errors, and you will be prompted to approve fixes.

If you're still experiencing problems, try removing your slax/changes and slax/images directories, and rebooting.

If your system is so corrupted that you cannot boot using the corrupted device, then boot into Porteus using another flashdrive or from a CD, insert the corrupted device once you have KDE up and running, and begin at step no. 3 above.
Last edited by Ahau on 07 Jan 2011, 16:04, edited 1 time in total.
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: [HOWTO] Repair a corrupted flashdrive (w/linux filesyste

Post#2 by fanthom » 07 Jan 2011, 15:59

Just to mention that Porteus has linux filesystem check for ext2,3,4 and reiserfs built into initrd. xfs doesn't need fsck as parition is checked automatically before being mounted. To take advantage of it, add 'fsck' cheatcode to your bootloader config and linux fs partitions will be scanned for errors each 25 mounts.

Ahau tried fsck cheatcode, but for some reason corruption was not discovered automatically. He had to force fsck as clearly described above :)
Thanks for sharing.
Please add [Solved] to your thread title if the solution was found.

Mactunes
Ronin
Ronin
Posts: 2
Joined: 09 Sep 2013, 11:50
Distribution: Porteus x86-64
Location: Planet Earth

Re: [HOWTO] Repair a corrupted flashdrive (w/linux filesyste

Post#3 by Mactunes » 09 Sep 2013, 11:57

Hi there.

I have Porteus on a Flashdrive (2 infact)

They are both having problems. I have FAT partitions with ext4 data files.

I get a message on login saying it cannot open 'console kit'

I can access all files, but I cannot use any usb ports or burn any data to back it up.

How do I go about repairing these file systems?

Thanks

Mactunes
Ronin
Ronin
Posts: 2
Joined: 09 Sep 2013, 11:50
Distribution: Porteus x86-64
Location: Planet Earth

Re: [HOWTO] Repair a corrupted flashdrive (w/linux filesyste

Post#4 by Mactunes » 09 Sep 2013, 11:59

BTW

I have tried -

3) You're going to run fsck (file system check) on the corrupted device. Open a terminal, type fsck, then press TAB twice. This shows you all of the options for fsck, and you'll choose the correct option for your filesystem. For example, my drive was formatted in ext3, so I used fsck.ext3.

I get no options from tab

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: [HOWTO] Repair a corrupted flashdrive (w/linux filesyste

Post#5 by fanthom » 09 Sep 2013, 15:18

hello Mactunes,

which filesystem are you trying to repair (fat, ext4, other?). is it placed on the flashdrive from which you are booting the porteus or internal PC hard drive?

you could boot with 'copy2ram' and without 'changes=' cheatcodes, then:
a) if you want to backup internal hd:
- take out the flash stick
- plug something else (external hd/other flash stick/DVD burner)
- make the internal hd backup
- repair corrupted fs
b) if you want to repair the stick from which you are booting:
- copy whole content of the stick to /root/backup (could use 'ramsize=' cheatcode if needed and delete save.dat if too big)
- repair/reformat stick
- copy everything from /root/backup back on the stick
- launch /boot/Porteus-installer-for-Linux.com to repeat installation
Please add [Solved] to your thread title if the solution was found.

Post Reply