From 0e29099e607ed4a337fb4d6c6e2f3614162f8fda Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 3 Apr 2019 14:58:04 +0200 Subject: [PATCH] Create symlinks for mapper and volume group dir --- debian/chroot.install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/chroot.install b/debian/chroot.install index 2c05c7e..6b2a9aa 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -146,5 +146,25 @@ done ### Fix group of LV chgrp disk -- /target/dev/dm-* ## }}} +## Create symlinks to LV +### Get the list of all LV +tmp_list_lv="/tmp/lv.rescue.list" +find /dev/"${vgname}" -maxdepth 1 -type l -printf "%f\\n" > "${tmp_list_lv}" + +### Create Volume Group and mapper directories +mkdir -p -- /target/dev/"${vgname}" +mkdir -p -- /target/dev/mapper + +### For each LV +while IFS= read -r LV_NAME +do + + #### Create symlink in Volume Group directory on the target system (eg. /dev/mapper/ovhsys/home -> ../dm-0) + [ -L /target/dev/"${vgname}/${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/"${vgname}/${LV_NAME}" + + #### Create symlink in mapper directory on the target system (eg. /dev/mapper/mapper/ovhsys-home -> ../dm-0) + [ -L /target/dev/mapper/"${vgname}-${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/mapper/"${vgname}-${LV_NAME}" +done < "${tmp_list_lv}" +rm -f -- "${tmp_list_lv}" # }}}