2

I have a USB HDD with an ext3 file system, (it's a Plex server media drive), connected to my Raspberry Pi, and after power failure it is not mounting automatically and has a superblock reading problem. After performing fsck on the drive it comes back to fully working condition.

The problem is - my Raspberry is headless server and there is a power failure almost everyday where I live now, so I need to ssh every time and do fsck to get the disk running again. Is there any way to:

  1. Perform fsck automatically (including answering the "yes" question)?

  2. Detect a power failure so it will do it on boot?

  • Please specify the file system of the USB drive. Tell us how the USB drive is being used when the power supply is steady -- i.e. are there a lot of disk writes, or does the R. PI server mainly run in RAM with a bit of network IO but few disk writes? – agc Oct 12 '17 at 13:52
  • The file system is ext3, it holds media for Plex server and sometimes downloading video from youtube so not writing all the time. – Alexey Demidov Oct 13 '17 at 3:46
1

To force fsck on each boot, set the count-down to 1 in the root filesystem:

tune2fs -c 1 /dev/mmcblk0p2

If tune2fs is not installed, it can be found in the e2fsprogs package.

0

Another way to do so is to add a command

touch /forcefsck

in your /etc/rc.local.

This creates a file forcefsck in the root dir each time the machine starts, which tells fsck to run upon next reboot.

Note that fsck will remove that file after checking the filesystem -- that's why you need to recreate it each time.

0

Based on the system being an ext3 file system used for Plex server media storage, the best thing might be to switch from the ext3 file system's default journal mode of data=ordered to its safest mode data=journal. The write speed hit shouldn't be a big deal on a media server, and a data journal should eliminate the need for any fsck.

Depending on the hardware, other tweaks might be necessary to make it work better, such as disabling the USB drive's cache, (if that turns out to be a problem), or putting the data journal on a separate device, (such as a small SSD).

Your Answer

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

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