I made a script which (tries to) duplicate my live disk /dev/sdb
to a second disk /dev/sda
, one rsync per partition (full script).
Last step is to install grub on /dev/sda
. The method I use is something like :
- mount /dev/sda root partition on
/mnt/root1
- bind-mount {/dev,/sys/,/proc} on /mnt/root1 :
# mount -o bind /sys /mnt/root1/sys
# mount -o bind /proc /mnt/root1/proc
# mount -o bind /dev /mnt/root1/dev
- run chrooted
update-grub
andgrub-install
on/dev/sda
:
chroot /mnt/root1 update-grub
chroot /mnt/root1 grub-install /dev/sda
- umount the 3 bind-mounts :
# umount /mnt/root1/sys
# umount /mnt/root1/proc
# umount /mnt/root1/dev
However, the /mnt/root1/dev
umount fails :
# umount /mnt/root1/dev
umount: /mnt/root1/dev: target is busy.
Note: the mount command gives for /dev
and /mnt/root1/dev
:
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8131896k,nr_inodes=2032974,mode=755,inode64)
udev on /mnt/root1/dev type devtmpfs (rw,nosuid,relatime,size=8131896k,nr_inodes=2032974,mode=755,inode64)
My questions are : How is it a bind-mount can be busy ? Is there a workaround ?
Edit: I was able to umount (in fact hiding the fact it is mounted, if I understand the man page) /mnt/root1/dev with umount --lazy
, but it looks incorrect to me.
Related question : https://stackoverflow.com/questions/7878707/how-to-unmount-a-busy-device
findmnt -R -o +PROPAGATION /mnt/root1/dev
umount --lazy
as a temporary fix).