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}" # }}}