Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use Ubuntu 10.04 on an embedded device. I have a CF card of 2GB formatted in FAT32. From time to time, the device is powered off while data is written to the FAT partition. As a result, the partition goes into read-only mode. I would like to know how the partition can be automatically repaired in such a situation, that is I would like to know how such an error can be detected e.g. with fsck and subsequently fixed.

I have tried using 'fsck.vfat -a -w /dev/sdax' always on boot but I have seen that taking too long and not really fixing the problem, since I had to do a 'fsck -y /dev/sdax' after that to fix the problem. So, I would like to check for errors and fix only if an error has already appeared or even always check for errors if that takes little time.

Thank you.

share|improve this question
2  
I guess the first question to answer is: why are you using vfat? Seems like moving to a somewhat modern and more fault-tolerant fs should be your first order of business. –  EEAA Jul 15 at 22:46
    
A more modern and fault tolerant filesystem is generally a good idea, but runs the risk of blowing through the limited write capacity of that ancient CF card in a very short time. –  Michael Hampton Jul 15 at 22:51

1 Answer 1

Using a filesystem with journaling, e.g., ext3, xfs, etc. will check your CF card partition's filesystem journal entries for errors once you power it back on. Vfat doesn't have journaling capabilities. You should look into the write frequency of vfat vs ext3 vs ntfs (ntfs has journaling but limited linux support).

If sticking to vfat, you can edit /etc/fstab and enable the fsck column (the last one by replacing zero with one) for your device, which will run fsck at bootup.

Use the fdisk -l to check on what linux says the partitions are, and the df or mount command to see if a device is mounted.

fsck is meant to be run on filesystems that are currently not mounted.

What you're looking for is a daemon to be running in the background, especially after you power up your device again, but it seems as though you're looking for windows compatibility.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.