I have a system running on a 4GB Nandrive.
When the drive is full, Ubuntu will not boot :( and I have to plug in a rescue thumbdrive to delete files.
The problem is the hardware is not easily accessible except via network.

Is there a sure-fire way to boot Ubuntu, say, to RAM or other means when the disk is full or on any other errors in the normal boot process?

4 Answers
4

I could suggest all sorts of weird solutions (one that came to mind: create a 250MB file on boot, delete it on shutdown - so there's always 250MB free) but the simple fact is you don't have enough storage space for your installation.

Either remove some data (and mount it over the network or an external drive) or buy a bigger root disk. 8GB, 16GB USB drives are not expensive and that'll save you faffing around with this every time it topples over the 4GB mark.

Thanks. Unfortunately Nands and SSDs seems to take disk full very badly and may not do proper shutdown on error condition. But maybe on boot, can detect disk full and delete the planted file? Where to plant such a code? rc.local is not run yet, dont think. Its an embedded system with storage hardwired.
–
RichardMar 28 '12 at 23:22

I re-tagged your question with initramfs to get the attention of anyone following that tag. Booting the OS to RAM (all the time) would certainly solve your problem, if your hardware can support this. Based on your choice of storage I'd venture to say this is an embedded system which might not have enough RAM to do a RAM drive, but I'll leave that to them to decide.

Yes, its an embedded system with hardwired Nandrive. Device is mounted 4 meters high on a pole. Rebooting to Ram all the time wld make the system completely non-persistent and is the last resort.
–
RichardMar 28 '12 at 23:18

You could mount storage areas onto non-volatile storage and then keep the OS itself in RAM. Occasionally back stuff up over the network and then delete the originals.
–
HuckleMar 29 '12 at 3:56

Thanks. This way wld the system boot under diskfull? How can I do that please? Thanks
–
RichardMar 31 '12 at 23:54

The advantage of using the RAM for the root filesystem here is that when the machine shuts off the contents of the RAM disappear. This means that it will always be free when the computer turns on. Your system would boot under a 'disk full' scenario because the RAM is not yet full.
–
HuckleApr 1 '12 at 17:22

Once it is booted, you can mount the Hard Drive to various parts of the filesystem as needed for your persistent changes. If any of them accidentally eat up 100% of the drive, simply reboot (if needed), and then copy those off via the network connection
–
HuckleApr 1 '12 at 17:23

May be there are certain areas in your system that you won't need after restart. If you mount them as tmpfs then at every restart that tmpfs will be free. You will have to study both "Mounting tmpfs" and "Areas which might not affect if not saved at reboots"

Thanks, thats an idea! intentionally mount the /largedataarea as tmpfs during boot and then test for diskfull and remount from Nandrive. Where to place this code? fstab and rc.local?
–
RichardMar 28 '12 at 23:27

Changes made to the filesystem will be lost when the computer shuts down, preventing the system from getting full and failing to boot. If you want persistent changes, you can add lines to /etc/fstab to mount persistent hard drive partitions. For example, if you wanted everything under /home to be persistent, you would make a partition of the hard drive (say /dev/sda1) and add this to /etc/fstab:

/dev/sda1 /home ext3 defaults 0 0

You'll likely want to check up on the usage of /home now and again, but if it fills up it will not prevent the system from booting.

Thanks a zillion :) For embedded systems,we really need the booting to be 110% robust. BTW, we are running a camera with builtin Atom cpu, 1G of ram, 4G nand drive, application is LPR or ANPR :)
–
RichardApr 2 '12 at 23:10

I'm glad this was helpful to you, please mark this as the accepted answer so others will be able to leverage this knowledge. Also, don't forget that you can upvote useful comments as well.
–
HuckleApr 4 '12 at 22:39