persistent pxe / nfs live

Kernels & Hardware, configuring network, installing services

persistent pxe / nfs live

Postby makayabou » 2016-10-04 15:49

Hello,
I'm using a Live Debian booting with PXE and using NFS sharing.
I would like to make the live with home partition writable, but I can't find a way.
I saw several how-to that were mainly explaining the way to create a persistent live-usb with Ubuntu.
I use mksquasfhs to compress my file system and booting on it.
Thanks for your help.
makayabou
 
Posts: 30
Joined: 2011-09-12 21:51

Re: persistent pxe / nfs live

Postby ruffwoof » 2016-10-04 20:10

If you add persistence boot parameter then it will look for a partition (or filesystem file) with the name (label) of persistence and use that ... provided there's a file in that partition (filesystem file) called persistence.conf

The easiest content of persistence.conf is

/ union

Note there's a space between the two ... and there must be a new line after the union (return/enter). That saves all changes. You can make persistence.conf move clever such as just saving changes to particular folders.

man live-boot shows some helpful detail.

I use grub4dos to boot and my menu.lst entry looks like

title 0 Debian Jessie Frugal RO only saves if run flush2disk
find --set-root /live/frugalboot
kernel /vmlinuz boot=live timezone=Europe/London xorg-resolution=1280x768 config nofastboot persistence persistence-read-only persistence-label=persistence quickreboot noprompt showmounts live-media-path=/live/ config rw
initrd /initrd.img

/live/frugalboot is just a empty flag file that I created for grub4dos to find. You can change the name from 'persistence' to something else for the partition label by changing the partition label and pointing to that using the persistence-label= boot parameter.

I actually use persistence persistence-read-only combination so it reads/loads the content of the persistence partition, but stores all changes in memory (doesn't record them), unless I run a script that I have that flushes all memory changes to disk (that I've named flush2disk). That way I can run a system, try things out such as installing programs, and a reboot has all of those changes undone (lost) except if I run flush2disk.

Note how the kernel boot parameters include a rw parameter which sets the / as rw.

Under my setup the persistence partition is the same that grub4dos is loaded into (grldr and menu.lst files) and its the same partition that /live and /boot folders are installed to. i.e. everything's in the same single partition.

Instead of a partition you can use a filesystem file, created using something like

dd if=/dev/zero of=persistence bs=1M count=1024
mkfs.ext4 persistence
mkdir mountpoint
mount persistence mountpoint
cd mountpoint
echo / union >persistence.conf
echo >>persistence.conf
cd ..
umount mountpoint
rmdir mountpoint

The blocksize (bs) of 1M and count of 1024 creates a 1GB filesystem file. Change that to whatever you prefer (bs=1G count=4 for example).

Personally I prefer using lzo for the mksquashfs choice. One of the faster decompressors albeit at the cost of less compression

i.e. mksquashfs with -comp lzo parameter added the end.
ruffwoof
 
Posts: 298
Joined: 2016-08-20 21:00

Re: persistent pxe / nfs live

Postby makayabou » 2016-10-07 14:39

Hello,

thank you for your very complete and precise answer.
However, I still can't manage to make it work.

Here is my config:
what I add in pxelinux.cfg/default : append initrd=live/debian/custom/initrd.gz boot=live persistence persistence-label=persistence persistence-path=live rootfstype=nfs netboot=nfs nfsroot=192.168.20.1:/srv/tftp/live/debian/custom rw

Code: Select all
bellinuxien@prod:/srv/tftp$ tree -L 4 live/debian/custom/
live/debian/custom/
├── initrd.gz
├── live
│   ├── filesystem.squashfs
│   └── persistence
└── vmlinuz


Code: Select all
bellinuxien@prod:/srv/tftp$ sudo mount live/debian/custom/live/persistence /mnt/persistence-debian-live/
bellinuxien@prod:/srv/tftp$ cat /mnt/persistence-debian-live/persistence.conf
/ union


I guess persistence filesystem file is not at the right place... Has it to be inside filesystem.squashfs ?

thanks for help..
makayabou
 
Posts: 30
Joined: 2011-09-12 21:51

Re: persistent pxe / nfs live

Postby makayabou » 2017-02-04 15:53

Hello,

I'm still stuck with the config, the error i get in live /boot.log is:
Code: Select all
mounting /dev/sr0 on live/persistence/sr0 failed: No such device


I thought the creation of persistence.conf was ok, wasn't it?
Code: Select all
bellinuxien@prod:/srv/tftp$ sudo mount live/debian/custom/live/persistence /mnt/persistence-debian-live/
bellinuxien@prod:/srv/tftp$ cat /mnt/persistence-debian-live/persistence.conf
/ union
bellinuxien@prod:/srv/tftp$ sudo umount /mnt/persistence-debian-live/


Thanks for any help..


Last bumped by makayabou on 2017-02-04 15:53.
makayabou
 
Posts: 30
Joined: 2011-09-12 21:51


Return to System configuration

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable