immutable section of HDD + differencing section

Hi forum,

You maybe know that VirtualBox has an “immutable” feature for HDD images. I.e. setup the system, if the stuff is in place, you can set the image to IMMUTABLE to prevent any changes to the image. Differences are written to a separated image.

So on the next boot you’ll see that all the (unintended) changes are gone and the “old” system is up & running again.

I run an old SuSE 10.3 on a write-protected SD-IDE-Adapter. Changing and playing with RPMs is a mess due to around 50 changes I had to do to make that work.

The issue: Is there any option to mount an SD-card as RO and having all the changes written to e.g. /dev/sda3?

To make it clear: I thought about something like a RAID-X system, but could not find any description on how to setup a raidtab.

Do you have any idea that could work without dismantling the low-level function, I’d appreciate that!

(I can get rid of the changes written to /dev/sda3 easily…)

Thanks for any helping hand!


Confused at what you want to do. You can mount just about any drive as RO but I know of nothing that would write changes to another partition.

Maybe you can explain why you want to do this???

You could try a union filesystem.

Union mount - Wikipedia, the free encyclopedia

Hi ken_yap,

wow! I checked Wiki and I think that’s the perfect solution! Thank you so much!

Hi gogalthorp,

to be more specific - even if it is already solved, maybe others can benefit from that too:

I need a solution where Linux can be booted by using an fs, that virtually accepts RW, but in reality the fs it boots from is set to RO (HW -> write protected SD-card).

When I got my server up an running some months ago (for WWW forwarding, SSH, SAMBA, Xvnc,…) I had to change some scripts until it would accept that the /dev/sda2 ( to be / ) is RO and even fsck should keep its fingers out. Of course /tmp, /var, /home resides on a RW HDD.
As soon as Linux detected the HW was RO I had strange messages indicating that IDs were wrong, but instead the SD-card reported a WRITE PROTECT.

Back again: Now I have to update the box and would not like to re-do the required changes in the lower levels of the OS.
In other words:

  • I have an “image” on a ext2 SD-card which is write protected
  • I have to boot from that image (/boot is also RO) and allow for RW as long as the box is running
  • at the next re-boot the changes from the previous boot & usage have to be rolled back → I need the same system on every boot sequence
  • in case I messed something up, I do not want to use e.g. the backup and restore the disk, just REBOOT
  • There should not be any changes in the boot image that I’m not aware of
  • copying the complete image to RAMDISK takes around 80 seconds + booting => too long
  • HW solution with SD-RAM are above 2000 € => not a solution for me
  • changing the HDD firmware to have the controller taking care for that stuff is currently too complex

==> the perfect HW-solution would be:

  • a HDD with an option (maybe via the diagnosis port - see e.g. HDD-guru) to set a range of LBAs to write protect
  • in parallel the HDD should provide a function to detour write requests to the protected area
  • additionally a table (volatile) to remember during run-time where these CHANGES were written to. Upon read use the changed sectors
  • At boot-up the “change-table” is set to “empty”, so the protected area is up again.
  • in case I need that changes, I’d un-protect the area, ran a script to do the required changed (e.g. updates, settings, etc.) and re-protect it after correction.

So the solution would be similar to the VirtualBox immutable image - where changes during run-time of the virtual machine are written to a differencing temporary image.

So in case there other ideas and solutions available that I had no idea of, please let me know!