Skip to contentSkip to conversation

Add mount option for initramfs

PATCH In review Roger Leigh 2 participants 4 messages Dec 16, 2011 – Dec 19, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add mount option for initramfs

Hi,

I've attached a trivial patch for an "initramfs" mount option. The purpose of this patch is that selected mounts in /etc/fstab can be identified for mounting in the generated initramfs. This will permit e.g. mounting of a separate /etc and /usr and any other admin-configured filesystems prior to init starting.

Uses: encrypted /etc and unencrypted / and /usr
separate /usr mounted with rootfs
- this means libraries and binaries on /usr are available from the initramfs onward, solving a whole host of problems with e.g. nss and pam modules having dependent libs in /usr, etc., which aren't available during boot.

Feel free to change the name to something more generic; this is intended for use with Debian's initramfs-tools initramfs generator, but may have potential for cross-distribution use.

Regards,
Roger

Signature · 4 lines
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
Quoted 1 line

From e588ddb89eb3d8b63291dd7cdad5c134fd221a2d Mon Sep 17 00:00:00 2001

From: Roger Leigh <[email protected]>
Date: Fri, 16 Dec 2011 23:07:35 +0000
Subject: [PATCH] mount: Allow initramfs dummy mount option

---
 mount/mount.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
mount/mount.c +1 -0
index 9b444c4..05e82fa 100644
@@ -202,6 +202,7 @@ static const struct opt_map opt_map[] = {
   { "nostrictatime", 0, 1, MS_STRICTATIME }, /* kernel default atime */
 #endif
   { "nofail",	0, 0, MS_COMMENT},	/* Do not fail if ENOENT on dev */
+  { "initramfs", 0, 0, MS_COMMENT},     /* Mount filesystem in initramfs */
   { NULL,	0, 0, 0		}
 };
 
Signature · 1 line
1.7.7.3
#1 lore raw

Re: [PATCH] Add man page entry for initramfs

Quoted 7 lines · Roger Leigh

Hi,

I've attached a trivial patch for an "initramfs" mount option. The purpose of this patch is that selected mounts in /etc/fstab can be identified for mounting in the generated initramfs. This will permit e.g. mounting of a separate /etc and /usr and any other admin-configured filesystems prior to init starting.

The following patch documents this in the mount(8) manpage.

Regards,
Roger

Signature · 4 lines
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
Quoted 1 line

From 6ea3cf1bdc58d2c1e0124967268d1d1e82c838a4 Mon Sep 17 00:00:00 2001

From: Roger Leigh <[email protected]>
Date: Sat, 17 Dec 2011 10:11:49 +0000
Subject: [PATCH 2/2] mount.8: Document initramfs mount option

---
 mount/mount.8 |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
mount/mount.8 +10 -0
index fc352b5..f7be9d3 100644
@@ -917,6 +917,16 @@ This option implies the options
 (unless overridden by subsequent options, as in the option line
 .BR group,dev,suid ).
 .TP
+.B initramfs
+The filesystem will be mounted by initial initramfs, before the root
+filesystem becomes available.  This permits separation of files
+required for boot onto separate filesystems, such as those in /etc and
+/usr.  This additionally permits selected encryption of files in /etc,
+for example, while leaving the remainder of the files in / and /usr
+unencrypted for performance.  Note that filesystems marked using this
+option may require the running of a tool to update the initramfs
+following any changes.
+.TP
 .B iversion
 Every time the inode is modified, the i_version field will be incremented.
 .TP
Signature · 1 line
1.7.7.3
maintainer
#2 lore raw
In reply to Roger Leigh
Quoted 2 lines · Roger Leigh
   { "nofail",	0, 0, MS_COMMENT},	/* Do not fail if ENOENT on dev */

+ { "initramfs", 0, 0, MS_COMMENT}, /* Mount filesystem in initramfs */

I don't think this is the right way. We have to be very conservative with new mount options, especially with options specific for any use case.

You can use comment=initramfs and in new mount(8) will be also supported x-* options, then you can use x-initrd or so.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
Quoted 10 lines · Karel Zak
Quoted 2 lines · Roger Leigh
   { "nofail",	0, 0, MS_COMMENT},	/* Do not fail if ENOENT on dev */

+ { "initramfs", 0, 0, MS_COMMENT}, /* Mount filesystem in initramfs */

I don't think this is the right way. We have to be very conservative with new mount options, especially with options specific for any use case.

You can use comment=initramfs and in new mount(8) will be also supported x-* options, then you can use x-initrd or so.

OK, no worries. I didn't realise you could use the comment syntax in this way, so either that or x-initramfs/x-initrd will do nicely.

Thanks,
Roger

Signature · 4 lines
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.