How to avoid corrupt drives if power outage is a huge issue?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to avoid corrupt drives if power outage is a huge issue?
I'm trying to setup a linux router system in Africa where power loss is not just a problem but a way of life. I have access to an old pentium 3 box with a 80GB hard drive but do to the location (middle of the Seringetti) access is VERY limited and we have no room nor permission to use a UPS due to potential chemical leakage from batteries. Because the power can go at any moment without any warning, I was wanting to possibly mount the file systems ro. I've looked into squashfs but that doesn't seem to like non-flash/SDD drives (if I'm wrong please correct me) so my question is, what file systems can i safely mount ro or can I get away with maybe using a ramdrive? Any help would be greatly appreciated.
1. I have seen devices using the microcore image (cd image) mounted RO or on RO media used. Something like TinyCore (based upon MICROCORE but with a gui desktop, help, and a few desktop application pieces) might be an option.
2. If you go with writable media, there is always a window for corruption. Use a journalized file system (ext3 or ext4 should help).
3. ANY (as far as I know) file system Linux recognizes can be mounted RO. Problem, linux uses tables and semiphore files to track state. A distribution specifically designed to do that entirely in memory and to assume RO media would be optimal.
Thus: I would look for a live-cd router image that you can customize for your environment, but that is already suitable in its basic operation and designed for running in memory. You might try Devil linux, Alpine, or Fli4l.
Best would be something that loads from media, but does not mount media and runs entirely in memory to help prevent opportunities for corruption. How easy that will be to find for your device depends upon what memory you have to work with. Second best would be a slightly custom version of TinyCore, or perhaps puppy.
Bottom line, this is doable. I have seen it done on machines entirely lacking a hard drive, running from CD or floppy.
Or you could run your drive off of a RAID card with a BBU. When power to the system drops, the BBU keeps the RAID card running long enough to flush the cache to the drive.
This is all just speculation, and I don't even know if it's possible, but here goes...
If you need to be able to write to the disk to save some stuff, maybe have 2 identical partitions. Have one mounted as RW. Every now and then, remount it RO. Then mount the second partition RW. Copy over the changed files (rsync, maybe?), then unmount the second partition. Finally, remount the first partition RO.
That way, while the first partition is vulnerable, the second one isn't even mounted, so it's safe. When you remount the first partition RO and mount the second partition RW, the first one is protected from corruption.
Like I said, I don't even know if it is possible to set up something like this, but it's an idea I had and I thought it had the potential to be useful.
I would also agree that you should use a journaled file system.
Depends on what you need this system for to begin with.
A squashfs (or other compressed read only format) will work fine on any media. Ramdrive is a good way to run on older systems. Puppy and other can either by default load to ram or with boot option. You would need a lot of ram and I doubt this has it.
A normal system can protect it's filesystem by means of a journal usually. You are still limited on this system for too many odd choices.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.