jago25_98
Posts: 25
Joined: Wed Aug 22, 2012 6:05 pm

Unexpected shutdowns protection - different filesystem?

Wed Jul 20, 2016 11:40 pm

NAS servers, routers, things like this have some sort of tolerance to unexpected shutdowns. You can just turn them off and they don't usually fail to turn back on.

How do they do this?

I want to make my Pi available remotely but I don't want it to become unavailable if the cleaner knocks the power supply and the next boot needs a fsck.

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 12:16 am

There's tolerance to unexpected shutdown and tolerance to unexpected abrupt power removal. Some journaling filesystems may make it appear as if they have no issues with sudden power loss, but they do. Mission critical devices typically have some sort of augmented power that effects a sane shutdown with sudden power disappearance.

If you don't want to have a failure when the power is pulled without shutdown, decide how valuable the data and install is and then decide if a UPS or a HAT with UPS capabilities is warranted or budgeted for with your project.

Short answer, don't pull the power.
Account Inactive

jago25_98
Posts: 25
Joined: Wed Aug 22, 2012 6:05 pm

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 4:27 am

OK.
I plan to schedule a shutdown before power cycle every day at night. But of course it's a good idea to use the best filesystem just in case, no?

swampdog
Posts: 380
Joined: Fri Dec 04, 2015 11:22 am

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 6:53 am

I'm planning to replace some virtual machines (VM) with pi's to save space & power. The VM host uses software raid1 and LVM (Logical Volume Manager) with (because it's old) ext3. That setup has seen me through most(*) issues. I haven't done it yet because my situation is complex. Nevertheless my plan is this..

An rpi3 with a pair of laptop drives. Configure two(**) mdadm raid1 devices, one for the OS, the other for data. Stick LVM on top of both and create two volume groups (eg: vg00 for the OS, vg01 for data). Create desired logical volumes and format ext4.

eg:
/dev/sd[ab]1 <- /dev/md1
/dev/sd[ab]2 <- /dev/md2

/dev/md1 <- OS
/dev/md2 <- data

(*)
Except the time there was a spate of "machine gun" power failures: on-off repeatedly which even killed the UPS. Even so (with much work) I managed to recover.

(**)
Ordinarily three mdadm devices. One for /boot (grub on both physical disks) but as the pi is booting off sd-card that can be dispensed with.

It's complex to set up at first but mdadm raid1 will allow you to replace a failed disk. Additionally there's nothing preventing you having more than a pair of disks in a raid1 mirror. You could run a triple mirror (or more likely use the third disk as a hot spare). With four disks you can have raid6 but ideally you need 5 disks (a hot spare). raid6 is less likely to fail during a rebuild than raid5.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 8:11 am

Embedded Linux devices use either read-only filesystems
or special filesystems on top of raw NAND. Consumer
SD cards have those super-secret FTLs and nobody knows
hat they do while you yourself are not writing to the card.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

jago25_98
Posts: 25
Joined: Wed Aug 22, 2012 6:05 pm

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 4:05 pm

OK. I stumbled on the answer. No and no, apparently. Glad I take advice with a pinch of salt. It's a ramdisk. Well, it is on OpenWRT. Perhaps OpenWRT can run on Pi... ah, yes it does:
viewtopic.php?t=145591&p=959666

Package support is poor but perhaps we can run the critical stuff in OpenWRT (routing, NAS disk, boot the O/S, ssh access)... and then put colinux (if only...) to create a VM within OpenWRT.

Alternatively, just stick with WRT.

Hope this helps someone :-)

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 5:06 pm

OpenWRT is a dead entity. All the main developers have left the project and now are working on LEDE. https://www.lede-project.org/

And while making the Pi into a router is a neat learning experience, PI's make intensely horrid routing platforms. If you want to go that route, pick and SBC with dedicated channels/pipes for the dataflows that you are using.
Account Inactive

Heater
Posts: 15949
Joined: Tue Jul 17, 2012 3:02 pm

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 5:56 pm

I would not say OpenWRT is a dead entity.

Perhaps forked and living on as LEDE.

From the link you posted:

"LEDE project is a Linux based embedded meta distribution based on OpenWrt and targeting a wide range of wireless SOHO routers and non-network devices.

LEDE spun away from the mother project in May 2016, aims for an open governance model and attempts to simplify contributing to encourage new developers in embedded development.

Since LEDE is a pretty young spinoff from OpenWrt it is largely compatible to it, in most cases the same installation procedures can be used to flash your devices."
Memory in C++ is a leaky abstraction .

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 6:06 pm

Perhaps it's a matter of semantics. OpenWRT is not getting any new commits, there are a few security commits being added. All the core developers are now commiting to LEDE and no longer updating OpenWRT. So it's in a permanent feature freeze without any active development.
Account Inactive

mutley
Posts: 61
Joined: Sat Jan 02, 2016 8:06 pm

Re: Unexpected shutdowns protection - different filesystem?

Thu Jul 21, 2016 6:17 pm

For the OS, make the OS a read only file system, and use a ramdisk for any files that need to be written but you don;t care about. Logs / File & App Locks, etc. Also get off the SD card and boot from USB as soon as possible as SD cards have terrible fault tolerance on the PI.
So, put the first stage boot loader on the SD card (as you have no alternative, except on a Pi3), and make it boot the OS in read only mode from a USB stick. Create a few ram disks, and your off.
As for data partitions, there are lots of options depending on what you are after and how much you want to spend, but it's the root partition listed above that will always give you the most grief and doing the above will make is as stable as you can get.

This is a good article on ro_root for PI
https://hallard.me/raspberry-pi-read-only/

This has info on USB boot
viewtopic.php?p=351659#p351659

Both may be a little out of date, but will point you in the right direction.

jago25_98
Posts: 25
Joined: Wed Aug 22, 2012 6:05 pm

Re: Unexpected shutdowns protection - different filesystem?

Fri Jul 22, 2016 6:45 am

Thanks Mutley, I'll give it a go :-)

Return to “General discussion”