Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #50487
| Path | csiph.com!goblin2!goblin1!goblin.stu.neva.ru!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Vagrant Cascadian <vagrant@debian.org> |
| Newsgroups | linux.debian.bugs.dist, linux.debian.kernel |
| Subject | Bug#468114: Loopback file system support. |
| Date | Wed, 12 Aug 2015 15:20:03 +0200 |
| Message-ID | <pWE6L-5sr-33@gated-at.bofh.it> (permalink) |
| References | <a1l9J-38V-9@gated-at.bofh.it> <agG2w-4gH-5@gated-at.bofh.it> <pWiIV-7IE-3@gated-at.bofh.it> <pWnSj-6JZ-37@gated-at.bofh.it> |
| X-Original-To | 468114@bugs.debian.org, 468114@bugs.debian.org, maximilian attems <max@stro.at>, Luke Yelavich <luke.yelavich@canonical.com>, 468114@bugs.debian.org |
| X-Mailbox-Line | From debian-bugs-dist-request@lists.debian.org Wed Aug 12 13:12:10 2015 |
| Old-Return-Path | <debbugs@buxtehude.debian.org> |
| X-Spam-Flag | NO |
| X-Spam-Score | -4.75 |
| Reply-To | Vagrant Cascadian <vagrant@debian.org>, 468114@bugs.debian.org |
| Resent-To | debian-bugs-dist@lists.debian.org |
| Resent-Cc | Debian kernel team <debian-kernel@lists.debian.org> |
| X-Debian-Pr-Message | followup 468114 |
| X-Debian-Pr-Package | initramfs-tools |
| X-Debian-Pr-Keywords | patch |
| X-Debian-Pr-Source | initramfs-tools |
| X-Spam-Bayes | score:0.0000 Tokens: new, 21; hammy, 150; neutral, 164; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-sha512, 0.000-+--H*UA:sk:x86_64-, 0.000-+--H*u:Notmuch, 0.000-+--H*u:notmuchmail.org, 0.000-+--H*UA:Notmuch |
| User-Agent | Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) |
| X-Hashcash | 1:20:150812:marcus.osdoba@googlemail.com::ssm5q11NwBtB4Lef:0000000000000000000000000000000000HFN |
| X-Hashcash | 1:20:150812:468114@bugs.debian.org::PKnPM/RGM4fr6Rlt:0000000000000000000000000000000000000000kJ9 |
| X-Hashcash | 1:20:150812:luke.yelavich@canonical.com::5ZmvXt2MvmduF7yz:00000000000000000000000000000000001FMb |
| X-Hashcash | 1:20:150812:468114@bugs.debian.org::2cC4DrdZTH0DYsoy:0000000000000000000000000000000000000002pSr |
| X-Hashcash | 1:20:150812:max@stro.at::55Wd6opw0f+kHq3f:000000Di3Q |
| X-Hashcash | 1:20:150812:468114@bugs.debian.org::b91DYlOWyzh2Nm99:000000000000000000000000000000000000000BUVj |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" |
| X-Debian-Message | from BTS |
| X-Mailing-List | <debian-bugs-dist@lists.debian.org> archive/latest/1198509 |
| List-ID | <debian-bugs-dist.lists.debian.org> |
| List-URL | <http://lists.debian.org/debian-bugs-dist/> |
| Approved | robomod@news.nic.it |
| Lines | 170 |
| Organization | linux.* mail to news gateway |
| Sender | robomod@news.nic.it |
| X-Original-Cc | Marcus Osdoba <marcus.osdoba@googlemail.com> |
| X-Original-Date | Wed, 12 Aug 2015 15:09:00 +0200 |
| X-Original-Message-ID | <878u9gejrn.fsf@aikidev.net> |
| X-Original-References | <20080227032108.GC14775@marin.yelavich.home> <20080409102516.GA20421@stro.at> <87y4hhc3fd.fsf@aikidev.net> <87vbclbo2v.fsf@aikidev.net> |
| Xref | csiph.com linux.debian.bugs.dist:671153 linux.debian.kernel:50487 |
Cross-posted to 2 groups.
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 2015-08-11, Vagrant Cascadian wrote:
> On 2015-08-11, Vagrant Cascadian wrote:
>> I've taken a quick stab as refreshing this, though I haven't yet tested
>> it. I did move mounting of the loopback to mount_loop_root in functions,
>> as I would like to eventually support loopback mounted files from NFS.
>
> Made some small changes, updated and *tested* this time! Patch below...
And added NFS support! Full patch below...
live well,
vagrant
diff --git a/init b/init
index abf7f25..2760bcb 100755
--- a/init
+++ b/init
@@ -98,6 +98,15 @@ for x in $(cat /proc/cmdline); do
;;
esac
;;
+ loop=*)
+ LOOP="${x#loop=}"
+ ;;
+ loopflags=*)
+ LOOPFLAGS="-o ${x#loopflags=}"
+ ;;
+ loopfstype=*)
+ LOOPFSTYPE="${x#loopfstype=}"
+ ;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
diff --git a/initramfs-tools.8 b/initramfs-tools.8
index ea8c098..ce8e830 100644
--- a/initramfs-tools.8
+++ b/initramfs-tools.8
@@ -42,6 +42,19 @@ The default is 180 seconds.
set the file system mount option string.
.TP
+\fB\fI loop
+path within the original root file system to loop-mount and use as the
+real root file system.
+
+.TP
+\fB\fI loopflags
+set the loop file system mount option string, if applicable.
+
+.TP
+\fB\fI loopfstype
+set the loop file system type, if applicable.
+
+.TP
\fB\fI nfsroot
can be either "auto" to try to get the relevant information from DHCP or a
string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS.
diff --git a/scripts/functions b/scripts/functions
index 8c1bb1f..2ed3ce3 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -426,6 +426,42 @@ mountfs()
${type}_mount_fs "$1"
}
+# Mount a loopback device, which is present on the mounted filesystem.
+mount_loop_root()
+{
+ mkdir -p /host
+ mount -o move ${rootmnt} /host
+ loopfile="/host/${LOOP#/}"
+
+ while [ ! -e "$loopfile" ]; do
+ panic "ALERT! $loopfile does not exist. Dropping to a shell!"
+ done
+
+ if [ ${readonly} = y ]; then
+ roflag=-r
+ else
+ roflag=-w
+ fi
+
+ # Get the loop filesystem type if not set
+ if [ -z "${LOOPFSTYPE}" ]; then
+ FSTYPE=$(get_fstype "$loopfile")
+ else
+ FSTYPE=${LOOPFSTYPE}
+ fi
+
+ # FIXME This has no error checking
+ modprobe loop
+ modprobe ${FSTYPE}
+
+ # FIXME This has no error checking
+ mount ${roflag} -o loop -t ${FSTYPE} ${LOOPFLAGS} "$loopfile" ${rootmnt}
+
+ if [ -d ${rootmnt}/host ]; then
+ mount -o move /host ${rootmnt}/host
+ fi
+}
+
# Mount the root file system. It should be overridden by all
# boot scripts.
mountroot()
diff --git a/scripts/local b/scripts/local
index f6424f0..072013e 100644
--- a/scripts/local
+++ b/scripts/local
@@ -135,7 +135,8 @@ local_mount_root()
ROOT=$(resolve_device "$ROOT")
- if [ "${readonly}" = "y" ]; then
+ if [ "${readonly}" = "y" ] && \
+ ([ -z "$LOOP" ] || [ "${FSTYPE#ntfs}" = "$FSTYPE" ]); then
roflag=-r
else
roflag=-w
@@ -153,6 +154,10 @@ local_mount_root()
else
mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
fi
+
+ if [ "${LOOP}" ]; then
+ mount_loop_root
+ fi
}
local_mount_fs()
diff --git a/scripts/nfs b/scripts/nfs
index 1c29850..d382413 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -72,6 +72,10 @@ nfs_mount_root_impl()
fi
nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}
+
+ if [ "${LOOP}" ]; then
+ mount_loop_root
+ fi
}
# NFS root mounting
Back to linux.debian.kernel | Previous | Next — Previous in thread | Find similar
Bug#468114: Loopback file system support. Vagrant Cascadian <vagrant@debian.org> - 2015-08-11 16:30 +0200
Bug#468114: Loopback file system support. Vagrant Cascadian <vagrant@debian.org> - 2015-08-11 22:00 +0200
Bug#468114: Loopback file system support. Vagrant Cascadian <vagrant@debian.org> - 2015-08-12 15:20 +0200
csiph-web