You are not logged in.

#1 2011-04-01 18:25:17

xul
Member
Registered: 2011-04-01
Posts: 4

Problem with filesystem corruption on USB-stick

I came to the forum to inform a problem I have in the last days, maybe someone find the info usefull.
I have a HD crash in the last days and I use a 1GB usb-stick to install arch to help me recover information, browse the web (searching for a new HD), etc. I made a "full" install, using

wiki.archlinux.org/index.php/Installing_Arch_Linux_on_a_USB_key
wiki.archlinux.org/index.php/Install_from_Existing_Linux

The process went ok and I have a little system for my prupose. But suddendly after booting I have multiple error, apparently from the FS driver, errors like Ext4-FS: ext4_reserve_inode_write: Journal has aborted, another says something about "Cannot read block bitmap", and the like, making the remounting of the only partition read-only or turning the system unusable.
Next I reformated the partiton to Ext2 and install arch again. All went ok again, I install Xorg, firefox and a couple of applications more. I boot a couple of times and all went fine. Then I think it was the Ext4 driver or something related, but after installing some more applications the same problems and similar errors appeared. In this case I search the last applications I installed, and the lastone was PCManFM. I boot with a live-cd chroot to the partition in cuestion and remove de package for PCManFM then, boot, and all went ok again. Now I am writing this using the USB-with-arch without problems and without PCManFM.

I read some post about some errors like I see on my screen so I come to post this to contribute a little.

Last edited by xul (2011-04-02 00:43:18)

Offline

#2 2011-04-02 00:42:42

xul
Member
Registered: 2011-04-01
Posts: 4

Re: Problem with filesystem corruption on USB-stick

Ooops... The problem persist. Evidently it doesn't have anything to do with PCManFM.
If I use a live-cd and fsck the only partition, the next time I reboot the problem disappeared. Now I think maybe it's something related to corrupting the filesystem in the moment of shutdown.
My problem maybe it's related to this https://bugs.archlinux.org/task/16368, I will try to contribute some more when I discover something new.

Offline

#3 2011-04-02 23:10:03

xul
Member
Registered: 2011-04-01
Posts: 4

Re: Problem with filesystem corruption on USB-stick

Apparently I find a solution.
I edit /etc/rc.shutdown to give time for the operations in the script before shuting down.
I added a sleep before and after remounting the root (and only fs).

sleep 3
stat_busy "Remounting Root Filesystem Read-only"
/bin/mount -n -o remount,ro /
stat_done
sleep 30
run_hook shutdown_poweroff

Probably the amount of time it's way too much, I will reduce it and see...

I rebooted several times and I don't experienced the problem again.

Last edited by xul (2011-04-02 23:11:14)

Offline

#4 2011-04-03 21:35:58

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Problem with filesystem corruption on USB-stick

I also have a problem with an external USB hard disk which sometimes shows ext4 errors just after booting (even though I carefully close all applications before shutting down and don't get any error before poweroff.) I don't know if this is related to your problem, but I'm going to add a "sync" command in rc.shutdown before the "umount -a". I'm thinking calling "sleep" is just a way to give time to the OS to write buffers to disk, so "sync" should be a faster/safer way to do it...

Thanks for the idea (I didn't know about rc.shutdown.)

Offline

#5 2011-04-04 05:14:04

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Problem with filesystem corruption on USB-stick

I was sure unmounting must force syncing of all data. Am I wrong?

I'm interested in robustness shutting down also as far as I use usb stick for AL in my NAS.


"I exist" is the best myth I know..

Offline

#6 2011-04-04 10:01:50

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Problem with filesystem corruption on USB-stick

student975 wrote:

I was sure unmounting must force syncing of all data. Am I wrong?

Well, that's a good question... I spent quite some time looking for information about that yesterday and didn't find any definitive answer. I, too, was assuming that umount *must* be syncing before unmounting, but its man page says nothing about it. I found an old post from 2004 from someone needing to sync his USB flash storage before umount. Someone else wrote that umount calls sync only when called with the "-a" option. I guess the only way to know for sure would be to study umount's source code...

Another possibility (for my problem) would be...

(...) the write cache on the disk itself sometimes doesn't get time to flush before the unit is powered down.

(from a 2002 post that may or may not be related to Linux.)
But I don't think USB sticks have any write buffer.

Last edited by stqn (2011-04-04 10:10:50)

Offline

#7 2011-04-04 10:17:05

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Problem with filesystem corruption on USB-stick

stqn wrote:

But I don't think USB sticks have any write buffer.

I'm next here smile

BTW, I suppose more legal way to modify shutdown process is to edit rc.local.shutdown which is called at the beginning of rc.shutdown.

Last edited by student975 (2011-04-04 10:28:24)


"I exist" is the best myth I know..

Offline

#8 2011-04-05 17:09:17

xul
Member
Registered: 2011-04-01
Posts: 4

Re: Problem with filesystem corruption on USB-stick

I agree with both of you, sync/rc.local.shutdown seems to be a "better" way of doing this. I will try that and see if it works for my case.

Thanks for the alternatives/discussion!

Offline

Board footer

Powered by FluxBB