You are not logged in.

#1 2010-10-27 03:07:37

xweb
Member
Registered: 2010-10-23
Posts: 5

Squash files system as root for experimentation.

What i have
basisc arch install 
----sda-------------------------------
sda1|[boot: kernel,etc] mounted on / as boot
sda2|[arch: /]  mounted as /
sda3|[home:mystuff] mounted on / as home
-----------------------------------------

What i Want.
Arch with squash filesystem as root.
----sda----------------------------------------------------------------------------
sda1[boot: kernel,etc] mounted on /(arch.sfs) as boot
sda2[arch.sfs] squash file system mounted as readonly /,  rw overlay folders
sda3[home: my stuff] mounted on /(arch.sfs) as home
-------------------------------------------------------------------------------------

Why?:
  I have an old computer and would like to use it for experimentation and development. I would like to have a non writable installation of arch Linux just after install and a writable overlay i can use to modify the system in different ways while being able to revert the system to a pristine state for my next experiment.

I need to mount a squash filesystem as /. This will allow me to mount different squash file systems depending on which Arch version or distro i need.
for example i could have a arch testing , archbang, or Chakra base install all stored as SFS file and selectable at boot time. any modification can be stored in the writable overlay directories.

Problem: how do i get arch to mount a squash file system as  /?

Offline

#2 2010-10-27 03:54:16

xweb
Member
Registered: 2010-10-23
Posts: 5

Re: Squash files system as root for experimentation.

i know this can be done. The live cd does it.

so far i have figured out i need to have the squashfs module included in the initrd file for my kernel. what i realy need to know is how to tell initrd how to find and mount my squashfs before it does the switch root to pass control to the os.

ps: is this the right forum for this?

Offline

#3 2010-10-27 04:33:26

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Squash files system as root for experimentation.

Why don't you check out larch -- I believe it uses a very similar system that you could either use or model.

Scott

Offline

#4 2010-10-27 04:46:52

xweb
Member
Registered: 2010-10-23
Posts: 5

Re: Squash files system as root for experimentation.

firecat53 wrote:

Why don't you check out larch -- I believe it uses a very similar system that you could either use or model.

Scott

Researching it now. I don't think i need any thing this complicated. but the answer is definitely some where in the source.

Offline

#5 2010-10-27 08:26:59

huuggee
Member
Registered: 2008-04-24
Posts: 9

Re: Squash files system as root for experimentation.

I have done this on my Asus eeepc, because space is/was so limited. However I only squashed the /usr/ partition as that takes up a huge chunk of space. My thinking was that squashing the entire tree may have made my machine unbootable if the squashfs module didn't load at boot. As it happens, the machine can become unbootable anyway as there is reliance on apps in /usr/, but that is by the by and recovery is always possible in chroot.

But the principle is the same. So long as you make sure the squashfs kernel mod is built into the initrd, then it will load at boot, or alternativley, don't have an initrd at all and boot straight into the kernel - which is what I think I have done.

It has been a while since I used my eeepc, but I can dig it out and just check how I did it.

Then I just ran an overlay using aufs, which works perfectly.
My fstab lines are like this:

/.usr/usr.sqfs  /usr  squashfs  ro,loop,nodev  0 0
none            /usr  aufs      nodev,noatime,dirs=/.usr/overlay=rw:/usr=ro  0 0

The real beauty here is that once you are happy with your aufs overlay, you can merge it back down into a new squashfs file and replace your old one. Then start again with a fresh overlay!

Offline

#6 2010-10-27 12:28:22

gradgrind
Member
From: Germany
Registered: 2005-10-06
Posts: 921

Re: Squash files system as root for experimentation.

xweb wrote:
firecat53 wrote:

Why don't you check out larch -- I believe it uses a very similar system that you could either use or model.

Scott

Researching it now. I don't think i need any thing this complicated. but the answer is definitely some where in the source.

No, of course you don't need anything that complicated. Just grab the larch-live package and look for the relevant bits in the larch hook (/lib/initcpio/hooks/larch) and the corresponding 'install' script (/lib/initcpio/install/larch). It's a matter of getting the initramfs to do what you want. archiso has something similar, which you should also have a look at, but I am not familiar with the innards of that package.

Offline

#7 2010-10-27 15:12:03

xweb
Member
Registered: 2010-10-23
Posts: 5

Re: Squash files system as root for experimentation.

I got it to boot the sqfs from the live cd mainly as a proof of concept.

first i copied the vmlinux26(kernel) and the archiso.img( initcpio[aka initrd]) to my boot partition.
I copied and rewrote the bootloader entry from the cd's isolinux.cfg file to my grub menu.lst

somthing like

title Arch Test
kernel /vmlinuz26-2 archisolable=arch_home tmp_size=75%
initrd /archiso.img

* i renamed vmlinuz26 to vmlinuz26-2 since i already had a vmlinuz26 on my boot partition
my home partiton is labled "arch_home"

also needed a file called isomounts from the cd before I got it to boot. i just copied it to the root of my home partition along with the system.sqfs from the cd.
 
Next: making it work the way i want.
basicly need to add the squashfs and aufs module to /etc/mkinitcpio.conf's modules section. and write a hook for the hook section that will find and mount my arch.sqfs file.
puppylinux does this every time it boot so it can't be that hard.

the hook scripts and modules get copied to the initrd image when you run mkinitcpio i think i can make a profile in /etc/mkinitcpio.d so i don't mess up my my initrd configuration.

I will post the details once i have worked them all out.

Last edited by xweb (2010-10-27 16:26:57)

Offline

Board footer

Powered by FluxBB