After unsuccessfully spending a while looking around on the net for a solution, I started writing out a plea for help on this forum, but halfway through writing I realised the ridiculously simple solution. There may be an even easier solution, but here is what I came up with. If you know of an easier way please let me (and everyone else) know.
The problem with using fsck to check an sfs file is that until the sfs file is mounted it is just a file on some other filesystem. But you can't mount it because fsck requires the device name and that the device not be mounted. Unfortunately I couldn't work out how to give an sfs file a device name without mounting it.
And then it hit me...
Go to your /etc/fstab file and enter something like this into it:
Code: Select all
/mnt/sdh1/pupsave.2fs /mnt/sdh1/pupsave ext2 defaults 0 0
Save the fstab file. Puppy will notice and now think that there is a device /mnt/sdh1/pupsave.2fs that is mounted as /mnt/sdh1/pupsave which is type ext2.
NOTE: I previously made the type "squashfs", and that worked, but after reading and considering Amigo's comments below and researching more on the web, I think it is safer for the type to be ext2.
Now open a terminal and use fsck to repair it like this:
Code: Select all
e2fsck /mnt/sdh1/pupsave.2fs
If it refuses to do anything, and says the filesystem is clean, you can force it using the -f option:
Code: Select all
e2fsck -f /mnt/sdh1/pupsave.2fs
When you're done, delete or comment out the line in your fstab. I commented out mine by putting a # character at the beginning of the line. Then if calamity befalls me again, all I need do is edit the relevant parts of the line and re-use it.
I only use ext2 filesystem inside an sfs file because journals add many more writes, shortening the lifespan of a flash memory device. Also I never use encryption because I have a crap memory for passwords.
NOTE: DO NOT do this with an encrypted sfs filesystem. I expect it will totally screw it.
But as watchdog mentions below there is a way to handle encryption. It is arguably simpler than my way of working on the 2fs file:
Code: Select all
losetup-FULL -E 1 /dev/loop2 /mnt/sdh1/pupsave.2fs
Code: Select all
losetup-FULL /dev/loop2 /mnt/sdh1/pupsave.2fs
Code: Select all
losetup-FULL -d /dev/loop2