Re: [Hampshire] unionfs and nfsroot

Top Page
Author: Andy Smith
Date:  
To: hampshire
Subject: Re: [Hampshire] unionfs and nfsroot

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x56acc100.hantslug.org.uk.23875': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Sun Apr 13 11:39:52 2008 BST
gpg: using DSA key 2099B64CBF15490B
gpg: Can't check signature: No public key
Hi,

On Sun, Apr 13, 2008 at 07:53:39AM +0000, Andy Smith wrote:
> I've got a virtual machine that's booted over NFS read-only but I
> want it to act a little bit like a live CD type of affair by doing a
> unionfs between its (NFS) root and /dev/shm/.union (tmpfs).


I have made some progress, though it has made my brain melt out of
my ears for now, and I will have to go and lie down with some
Stereolab and Belle & Sebastian on. May also have some toast.

I edited /usr/share/initramfs-tools/scripts/nfs and replaced this
line:

        nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}


with:

        mkdir -p /nfs
        mkdir -p /cow
        mount -nt tmpfs none /cow
        nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} /nfs
        mount -nt unionfs -o dirs=/cow=rw:/nfs=nfsro unionfs ${rootmnt}
        mkdir ${rootmnt}/UNIONFS
        mkdir ${rootmnt}/NFS
        mount -n --move /cow ${rootmnt}/UNIONFS
        mount -n --move /nfs ${rootmnt}/NFS


and then updated the initrd from that.

It now does boot and seems to all work fine, although the list of
mounted filesystems looks rather odd:

# mount
rootfs on / type rootfs (rw)
none on /sys type sysfs (rw)
none on /proc type proc (rw)
udev on /dev type tmpfs (rw)
none on /UNIONFS type tmpfs (rw)
10.13.194.71:/data/share/rescue on /NFS type nfs (ro,vers=3,rsize=32768,wsize=32768,hard,nolock,proto=tcp,timeo=7,retrans=3,sec=sys,addr=10.13.194.71)
unionfs on / type unionfs (rw,dirs=/UNIONFS=rw:/NFS=nfsro,debug=4294967295,delete=whiteout)
unionfs on /dev/.static/dev type unionfs (rw,dirs=/UNIONFS=rw:/NFS=nfsro,debug=4294967295,delete=whiteout)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid)
varrun on /var/run type tmpfs (rw,nosuid)
varlock on /var/lock type tmpfs (rw,nosuid,nodev,noexec)
devpts on /dev/pts type devpts (rw,nosuid,noexec)
none on /var/tmp type tmpfs (rw)
# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 40G   24G   14G  63% /
udev                   10M   24K   10M   1% /dev
none                   61M  284K   60M   1% /UNIONFS
10.13.194.71:/data/share/rescue
                       40G   24G   14G  63% /NFS
unionfs                40G   24G   14G  63% /
unionfs                40G   24G   14G  63% /dev/.static/dev
tmpfs                  61M     0   61M   0% /lib/init/rw
varrun                 61M   24K   61M   1% /var/run
varlock                61M     0   61M   0% /var/lock
none                   61M     0   61M   0% /var/tmp


and notably I can only tell how much real writable space I have left
by looking at the /UNIONFS one.

So judging by the ugliness I've probably still done something wrong.

And thanks Dave for the pointer to aufs, I'll look at that one
later..

Cheers,
Andy