1

I posted this question on the Raspberry Pi forum but got no activity. If it is a dumb question or something else, please say so...

While not often, I do experience power outages which stop one of my Pis and then usually results in the USB stick having the "dirty bit" set.

I know how to fix this manually:

sudo dmesg |grep sda1 ==> this finds references to sda1 in the message log.

If I see that it has reported a dirty bit for sda1 then I do the following:

  1. sudo umount /boot
  2. sudo fsck -V /dev/sda1 ==> answer questions based on the following output:

    fsck.fat 3.0.24 (2013-11-23)
    0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
    1) Remove dirty bit
    2) No action
    

    I reply this: ? 1
    More output:

    Starting check/repair pass.
    Starting verification pass.
    Leaving filesystem unchanged.
    /dev/sda1: nn files, mmm/ooo clusters
    
  3. sudo fsck -a /dev/sda1

  4. mount /boot

However, I would like to automate this in a script which could be run manually or during boot up. Can anyone assist or point me to a good reference? Obviously, I may also want to do this for the SD card OS partition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.