newSizeInByte=$2
newSizeInSectors=$[$newSizeInByte/512];
cryptDevice="$1"
cryptedDevice="/dev/mapper/resizeDevice"
echo "Opening the crypt partition"
cryptsetup luksOpen "$cryptDevice" "$cryptedDevice"
echo "Resizing cryptED partition";
resize2fs "$cryptedDevice" $newSizeInSectors;
echo "Resizing crypt partition";
cryptsetup --size $newSizeInSectors resize "$cryptedDevice"
offset=2056
echo "Guessing offset to $offset sectors";
cryptsetup status "$cryptedDevice" \| grep offset
echo "Closing crypt partition";
cryptsetup luksClose "$cryptedDevice"
echo "Resizing crypt containing partition";
cryptSizeInKiloByte=$[($newSizeInSectors+$offset)/2];
fdisk "$cryptDevice" < echo -e "p\nd\nn\np\n1\n\n${cryptSizeInKiloByte}K\np\nw"
Freitag, 29. April 2011
Resize LUKS crypted partition without and sans LVM
Wer mal wissen will wie sowas von statten geht, hier meine Anleitung.
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen