From: Major Hayden <major-rCS72UCksqc@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] Adding support for read/write filesystem images
Date: Mon, 04 Aug 2014 10:47:32 -0500 [thread overview]
Message-ID: <53DFAB14.1020201@mhtx.net> (raw)
A user can provide a filesystem image (rootfs.img) inside a compressed
tarball and that filesystem image will be mounted read/write. This provides
some benefits over a device mapper snapshot overlay, especially when the
live system becomes full. The boot command line simple needs
"rd.writable.fsimg" added to utilize this feature.
Signed-off-by: Major Hayden <major-rCS72UCksqc@public.gmane.org>
---
modules.d/90dmsquash-live/dmsquash-live-root.sh | 16 ++++++++++++++--
modules.d/90dmsquash-live/module-setup.sh | 2 +-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh
b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 5705e8d..c6c02c7 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -4,6 +4,8 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+command -v unpack_archive >/dev/null || . /lib/img-lib.sh
+
PATH=/usr/sbin:/usr/bin:/sbin:/bin
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
@@ -26,6 +28,7 @@ getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
getargbool 0 rd.live.overlay.reset -d -y reset_overlay &&
reset_overlay="yes"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay &&
readonly_overlay="--readonly" || readonly_overlay=""
overlay=$(getarg rd.live.overlay -d overlay)
+getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
# CD/DVD media check
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
@@ -180,9 +183,18 @@ fi
if [ -n "$FSIMG" ] ; then
BASE_LOOPDEV=$( losetup -f )
- losetup -r $BASE_LOOPDEV $FSIMG
- do_live_from_base_loop
+ if [ -n "$writable_fsimg" ] ; then
+ # mount the provided fileysstem read/write
+ echo "Unpacking live filesystem (may take some time)"
+ unpack_archive $FSIMG /tmp/fsimg/
+ losetup $BASE_LOOPDEV /tmp/fsimg/rootfs.img
+ echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear
$BASE_LOOPDEV 0" | dmsetup create live-rw
+ else
+ # mount the filesystem read-only and add a dm snapshot for writes
+ losetup -r $BASE_LOOPDEV $FSIMG
+ do_live_from_base_loop
+ fi
fi
# we might have an embedded fs image on squashfs (compressed live)
diff --git a/modules.d/90dmsquash-live/module-setup.sh
b/modules.d/90dmsquash-live/module-setup.sh
index 851fd1a..95c3566 100755
--- a/modules.d/90dmsquash-live/module-setup.sh
+++ b/modules.d/90dmsquash-live/module-setup.sh
@@ -13,7 +13,7 @@ check() {
depends() {
# if dmsetup is not installed, then we cannot support fedora/red hat
# style live images
- echo dm rootfs-block
+ echo dm rootfs-block img-lib
return 0
}
--
2.0.3
next reply other threads:[~2014-08-04 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 15:47 Major Hayden [this message]
[not found] ` <53DFAB14.1020201-rCS72UCksqc@public.gmane.org>
2014-08-15 10:26 ` [PATCH] Adding support for read/write filesystem images Harald Hoyer
[not found] ` <53EDE06B.80900-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-08-15 13:22 ` Major Hayden
[not found] ` <53EE099D.2070402-rCS72UCksqc@public.gmane.org>
2014-08-15 14:07 ` Harald Hoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53DFAB14.1020201@mhtx.net \
--to=major-rcs72ucksqc@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.