2015-08-02

Slitaz -- Loop install / UUID


Loop install
http://doc.slitaz.org/en:guides:uncommoninst#loop-install
Boot setup
[..]
title SliTaz cooking in loop file
map (hd0,0)/boot/slitaz-cooking.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage mount=/dev/hda1 loopfs=data/slitaz.fs
initrd (hd1)/boot/rootfs.gz
title SliTaz cooking in RAM (like the Live CD)
map (hd0,0)/boot/slitaz-cooking.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage rw root=/dev/null autologin
initrd (hd1)/boot/rootfs.gz
Or, you can replace the device name of the mount variable by the UUID or LABEL returned by blkid:
title SliTaz cooking
map (hd0,0)/boot/slitaz-preinit.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage mount=a4b346ee-4c7b-46aa-9fd4-6bc39ab4fa96 loopfs=data/slitaz.fs
initrd (hd1)/boot/rootfs.gz
mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
tmpfs: Bad value '90%' for mount option 'nr_inodes'


1.
root@slitaz:~# cat /proc/cmdline
mount=b9f5cf75-b3a0-4c86-bd48-3933094a7551 loopfs=slitaz.fs

2.
root@slitaz:~# head -11 /var/log/boot.log
Mount b9f5cf75-b3a0-4c86-bd48-3933094a7551...
mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Sleep 2 seconds...mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
mount: mounting tmpfs on /mnt failed: Invalid argument
[ Skipped ]

Loading module: squashfs
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]

3.
root@slitaz:~# grep tmpfs /var/log/dmesg.log
tmpfs: Bad value '90%' for mount option 'nr_inodes'

4.
root@slitaz:~# blkid | grep sdb
/dev/sdb1: LABEL="slitaz-318" UUID="b9f5cf75-b3a0-4c86-bd48-3933094a7551" TYPE="ext4" PARTUUID="02190218-01"

5.
root@slitaz:~# grep -A 7 'mnt()' /init
mnt()
{
r=$(blkid 2> /dev/null | sed "s|\"||g;/$(echo $root | tr / .)/!d;s|:.*||;q")
r=${r:-$root}
r=${r#/dev/}
r=/dev/${r%%/*}
d=${root#*$r}

6.
root@slitaz:~# grep -A 4 rootfsinodes /init
got rootfsinodes && inodes=$root
root=90%
got rootfssize
[ $(busybox free|busybox awk '/Mem:/{print int(($4*100)/$3)}') -ge $r ] &&
busybox mount -t tmpfs -o size=$root,nr_inodes=$inodes tmpfs /mnt &&
root@slitaz:~#

http://hg.slitaz.org/slitaz-boot-scripts/rev/d6c818f35639