[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Debian Live on an LVM-enabled media



	What's the way to install Debian Live on an LVM logical volume?

	I know that neither kernel nor initramfs image can reside on an
	LVM volume since the bootloaders don't support these, thus a
	separate partition would be necessary for them (not to mention
	the bootloader's files.)  However, having Debian Live installed
	on an Ext3 filesystem on top of an LVM volume seems to have at
	least the following benefits:

	* the filesystem could be expanded or reduced dynamically (with
	  lvreduce(8), lvextend(8) and ext2online(8); it's important for
	  space-scarce media, such as USB Flash drives;

	* the filesystem could be updated by Rsync, overwriting only the
	  files that were actually changed, thus saving the write cycles
	  resource; it's again important for space-scarce media;

	* arbitrary number of Live images could be installed on the same
	  media.

	On the other hand, Ext3 would probably be much less
	space-efficient than Squashfs.

	Anyway, IIUC, the only steps to do to make it happen (as of
	initramfs-tools 0.92j) are:

	* enable LVM on the `live-premount' stage, or earlier, as by
	  duplicating scripts/local-top/lvm2 also in live-premount/ (but
	  it should be ensured that it's run only after all the media
	  are detected by the kernel);

	* make a new meaning for the `root=' option when given without
	  `plainroot', roughly:

--- scripts/live.~1~
+++ scripts/live
@@ -1408,6 +1408,15 @@
 		then
 			# Do a local boot from hd
 			livefs_root=${ROOT}
+		elif [ -n "${ROOT}" ]
+		then
+			## do a local mount
+			log_begin_msg "Mounting live ${ROOT} to ${mountpoint}"
+			if mount -t ext3 -o ro,noatime "${ROOT}" "${mountpoint}" ; then
+				livefs_root=${mountpoint}
+			else
+				panic "Unable to mount ${ROOT}"
+			fi
 		else
 			# Scan local devices for the image
 			for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


Reply to: