Here's a script which works in ubuntu bionic. i've not enough rep to comment, but, at least in ubuntu bionic, the initramfs looks in /etc/fstab for /usr immediately after mounting the root, so adding an init-bottom script is "too late". instead see the tweak suggested here:
#!/bin/bash -f
#copyleft 2018 greg mott
#set a subdirectory as root (so multiple installs don't need partitions)
#these work in ubuntu bionic, could be different elsewhere
#1st choice: tweak initramfs-tools/scripts/local
# pro: no risk that some initramfs script might see the partition root
# con: only works if the (subdirectory's) initramfs/initrd is tweaked and rebuilt
#2nd choice: specify this script as init= on the kernel commandline
# pro: no need to tweak the initramfs
# con: this script runs in a shell in the partition root
#the tweak for bionic:/usr/share/initramfs-tools/scripts/local is replace:
# mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
# mountroot_status="$?"
#with:
# (set -x
# mkdir part #mountpoint for partition root
# part=$rootmnt a=" $(cat<proc/cmdline) " b=${a#* subroot=};[ "$a" = "$b" ]&&echo subroot not specifyed||subroot=${b%% *} part=part #extract subroot from kernel commandline
# mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} $part&&[ $subroot ]&&mount --bind part/$subroot $rootmnt&&umount part #mount partition, mount subroot, unmount partition root
# )
# mountroot_status="$?"
# #sleep 90 #if needed to debug, also remove splash, and maybe quiet, from kernel cmdline
#then run "update-initramfs -u" for the current kernel, future kernel installs will do that automatically
#for either choice copy /etc/grub.d/40_custom to /etc/grub.d/07_custom and add one or more menuentries that specify subroot:
#menuentry "subroot foo" {
# echo "subroot foo"
# sub=foo
# uuid=22e7c84a-a416-43e9-ae9d-ee0119fc3894 #use your partition's uuid
# search --no-floppy --fs-uuid --set=root $uuid
# linux /$sub/vmlinuz ro root=UUID=$uuid subroot=$sub
# echo "initrd /$sub/initrd.img"
# initrd /$sub/initrd.img #works in recent releases where the /initrd.img softlink is relative
#}
#to use this script, in addition to subroot= on the kernel commandline also specify:
# init=pat pathname from partition root to this script (chmod 744)
subroot(){ a=" $(cat<proc/cmdline) " b=${a#* subroot=}
[ "$a" = "$b" ]&&{ echo no subroot on kernel cmdline;return 1;}||subroot=${b%% *} #extract subroot from kernel commandline
while read -r m r m
do for m in $M x #build list of what's already mounted
do [[ $r = $m* ]]&&break #exclude subtrees (ie dev/**)
done||[[ $r = / ]]||M=$M\ $r #exclude /
done<proc/mounts
(set -x;mount --bind $subroot mnt)||return #mount subroot
for m in $M
do (set -x;mount -n --move $m mnt$m)||return #move listed mounts to subroot
done
set -x
cd mnt&&
pivot_root . mnt&& #subroot becomes root
umount -l mnt #unmount partition root
}
subroot&&exec chroot . init "$@"||exec bash #land in a shell if anything fails