improve umount mecanism
This commit is contained in:
parent
e9bc79f735
commit
b780ac75ae
1 changed files with 22 additions and 3 deletions
25
dmount
25
dmount
|
@ -22,7 +22,7 @@ Mountpoint_data=/home/primardj/data
|
||||||
|
|
||||||
force_remove_vgdevice() {
|
force_remove_vgdevice() {
|
||||||
echo "force remove vg cryptdata"
|
echo "force remove vg cryptdata"
|
||||||
doas dmsetup info --columns
|
#doas dmsetup info --columns
|
||||||
doas dmsetup remove /dev/mapper/cryptdata-*
|
doas dmsetup remove /dev/mapper/cryptdata-*
|
||||||
doas dmsetup remove /dev/mapper/cryptdata
|
doas dmsetup remove /dev/mapper/cryptdata
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,31 @@ umount_devices() {
|
||||||
doas umount -R $Mountpoint_data
|
doas umount -R $Mountpoint_data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_umount() {
|
||||||
|
echo "Error, can't umount all devices, need some manual help." >&2
|
||||||
|
lsblk
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error_deactivate_vg() {
|
||||||
|
echo "Error, impossible de deactive vg." >&2
|
||||||
|
doas dmsetup info --columns
|
||||||
|
echo "Try to force remove vgdisk from memory." >&2
|
||||||
|
if force_remove_vgdevice
|
||||||
|
then
|
||||||
|
echo "could at list remove vgdevice."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "couldn't remove vgdevice. need manual intervention." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
umount_lvm_on_luks() {
|
umount_lvm_on_luks() {
|
||||||
echo "locking device cryptdata"
|
echo "locking device cryptdata"
|
||||||
umount_devices || echo "Error; can't umount devices" >&2 && exit 0
|
umount_devices || error_umount
|
||||||
|
|
||||||
#doas umount -R /home/primardj || echo "Error, can't umount devices" >&2 && exit 0
|
|
||||||
doas lvchange -a n cryptdata || force_remove_vgdevice
|
doas lvchange -a n cryptdata || force_remove_vgdevice
|
||||||
doas cryptsetup close cryptdata
|
doas cryptsetup close cryptdata
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue