Gentoo Archives: gentoo-user

From: Grant Taylor <gtaylor@×××××××××××××××××××××.net>
To: Gentoo-Users <gentoo-user@l.g.o>
Subject: [gentoo-user] HACK: Boot without an initramfs / initrd while maintaining a separate /usr file system.
Date: Mon, 05 Aug 2019 01:36:50
On 8/4/19 7:26 PM, Grant Taylor wrote:
> I am also using a bit of a hack that I think could be (re)used to allow > /usr being a separate file system without /requiring/ an initramfs / > initrd. (I'll reply in another email with details to avoid polluting > this thread.)
I think that a variation of a technique I'm using for LUKS encrypted /home on a VPS could be used to allow booting without an initramfs / initrd while maintaining a separate /usr file system. The problem is that /bin & /sbin would be symbolic links to /usr/bin & /usr/sbin. So, any commands that would be needed to mount the /usr file system would need to be directly accessible in /bin & /sbin paths, or indirectly accessible in /usr/bin & /usr/sbin. IMHO this is a whopper of a hack. Create the bin and sbin directories inside of the /usr directory that is the mount point so that they are on the underlying file system that /usr is mounted over top of. Then copy the needed binaries to the /usr/bin & /usr/sbin directories on the underlying file system. That way, /sbin/fsck -> /usr/sbin/fsck still exists even before the real /usr is mounted. I did say this is a whopper of a hack. It's trivial to access these directories even when the normal / full /usr is mounted. 1) mkdir /mnt/root-underlay 2) mount -o bind / /mnt/root-underlay 3) ls /mnt/root-underlay/bin /mnt/root-underlay/sbin This "technique" / "trick" / "hack" works because the /bin & /sbin ""directories are sym-links to the /usr/bin & /usr/sbin directories. There is nothing that means that the contents of (/usr)/(s)bin can't change from one command invocation to another. The /(s)bin sym-links just need to point to a valid directory. They can easily be on the root-underlay file system that /usr gets mounted on top of. -- Grant. . . . unix || die