From 89a695a5e79d1c4811ce3a476b672b97900f4a2a Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 15 Feb 2017 23:18:02 -0800 Subject: [PATCH] [union-mount] Rescan dev if root partition disapear (#298) On some platforms after the initramfs init scripts have mounted the root device its block device disapear from /dev. The union-mount script therefore can't mount the root device over the aufs. If this case happen, issue a rescan of the devices to repopulate the /dev filesystem. --- files/initramfs-tools/union-mount.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 531436c39a..037a9c2403 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -8,6 +8,8 @@ esac ## Mount the aufs file system: rw layer over squashfs mkdir -p ${rootmnt}/host/rw mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt} +## Check if the root block device is still there +[ -b ${ROOT} ] || mdev -s ## Mount the raw partition again mount ${ROOT} ${rootmnt}/host ## Mount the working directory of docker engine in the raw partition, bypass the aufs