site  contact  subhomenews

Filesystem check after improper shutdown

March 16, 2010 — BarryK
This is now implemented in Woof, for the case of a full hard-drive installation. I have yet to implement it for other modes of installation of Puppy.

I already mentioned that silverpuppy and mikeb did some work on this, and thanks guys, it was helpful to read about your experiences. It made me fully aware of all the issues.

One of the problems with doing a check/repair on a ext2, ext3 or ext4 filesystem is that the partition should be unmounted. But, how to achieve that with a full hd installation? Silverpuppy and mikeb implemented a f.s. check when the partition is mounted but while it is still read-only.

My solution is that on the boot after an improper shutdown, a ramdisk is created and populated with a complete functional mini-Puppy environment, and then a "pivot_root" is performed into the ramdisk and the hard-drive partition is unmounted. This is kind of the reverse of a live-CD or frugal pup bootup!

Once execution has switched into the ramdisk, a filesystem check is performed on the partition, then the computer is rebooted.

The scripts that are modified in Woof are:

/etc/rc.d/rc.sysinit: creates a file /fsckme.err, which contains the partition and filesystem (ex: sda7,ext3)
/etc/rc.d/rc.shutdown: deletes /fsckme.err
/sbin/init: this was previously a symlink to busybox. this does all the clever stuff.

If you want to know how to create a mini-Puppy, look at /sbin/init. It copies 5-6 megabytes (uncompressed) of files into the ramdisk. It has to be small as Puppy kernels are compiled with ramdisk size set at 13MB. The script performs a pivot_root then runs the e2fsck program. It also sets the system time correctly prior to doing the f.s. check. After the check, it asks you to press the ENTER key for a reboot, otherwise times out after 4 minutes and does the reboot.

Probably tomorrow I'll add improper-shutdown handling for the other modes of Puppy installation. Expect Quirky 010 in a couple of days!


Username: Improper shutdown
Thank you very much. I am fed up with improper shutdown for the past several years. I hope, you have solved this problem. I hope to test the same very shortly.

No data loss ever on puppies!
Username: jamesbond
"I've been running various puppies now, starting from 2.13. I need to state here regardless of what others are saying, I have *never-ever* had a corruption on the pup_save that lead to data loss. I know the shutdown is "improper" - but I'm not fed up with it because it doesn't do any harm to me and my data. Thank you Barry and others for the work of love, and sharing what you did for the rest of us. You didn't have to, but you did. Thank you.

Tags: woof