apamix
February 14th, 2012, 04:17 PM
Hello everybody,
I have one little big problem. I Have a encrypted hdd but the root partition is to little :(
[root@PCrevisie:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/PCrevisie-root
322M 292M 14M 96% /
tmpfs 1013M 0 1013M 0% /lib/init/rw
udev 1008M 228K 1008M 1% /dev
tmpfs 1013M 4.0K 1013M 1% /dev/shm
/dev/sda1 228M 16M 201M 7% /boot
/dev/mapper/PCrevisie-home
58G 36G 20G 65% /home
So my idea is now to cut 1GB from the /home partition and add it to the root partition but I will need some help. After I read some tutorials I think the prodcedure must go this way :
1) BACK UP before I start crying
2) Boot the live cd and then :
sudo apt-get update && sudo apt-get install lvm2 cryptsetup
# Loading it to kernel
sudo modprobe dm-crypt
# Open the encrypted partition
sudo cryptsetup luksOpen /dev/sda2 crypt1
# And we must recognize him.
sudo vgscan --mknodes
sudo vgchange -ay
Here was easy and I think I will have no problems.. but now come the hard part. And I'm not sure about it so here I will need some help. I think will be something like :
# Checking the partition for errors
sudo e2fsck -f /dev/mapper/PCrevisie-home
# Because I want to reduce the home partition with 1GB
sudo lvreduce -L -1G /dev/PCrevisie/home
# Now I want to add this 1GB to the root partition
lvresize -L +1G /dev/PCrevisie/root
#Now I Need to lock the partition again
sudo pvchange -x n /dev/mapper/crypt1
#And now I must resize the filesystem
sudo e2fsck -f /dev/mapper/PCrevisie-root
sudo resize2fs -p /dev/mapper/PCrevisie-root
If I'm getting somewhere wrong will be very nice to get some assist.
I have one little big problem. I Have a encrypted hdd but the root partition is to little :(
[root@PCrevisie:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/PCrevisie-root
322M 292M 14M 96% /
tmpfs 1013M 0 1013M 0% /lib/init/rw
udev 1008M 228K 1008M 1% /dev
tmpfs 1013M 4.0K 1013M 1% /dev/shm
/dev/sda1 228M 16M 201M 7% /boot
/dev/mapper/PCrevisie-home
58G 36G 20G 65% /home
So my idea is now to cut 1GB from the /home partition and add it to the root partition but I will need some help. After I read some tutorials I think the prodcedure must go this way :
1) BACK UP before I start crying
2) Boot the live cd and then :
sudo apt-get update && sudo apt-get install lvm2 cryptsetup
# Loading it to kernel
sudo modprobe dm-crypt
# Open the encrypted partition
sudo cryptsetup luksOpen /dev/sda2 crypt1
# And we must recognize him.
sudo vgscan --mknodes
sudo vgchange -ay
Here was easy and I think I will have no problems.. but now come the hard part. And I'm not sure about it so here I will need some help. I think will be something like :
# Checking the partition for errors
sudo e2fsck -f /dev/mapper/PCrevisie-home
# Because I want to reduce the home partition with 1GB
sudo lvreduce -L -1G /dev/PCrevisie/home
# Now I want to add this 1GB to the root partition
lvresize -L +1G /dev/PCrevisie/root
#Now I Need to lock the partition again
sudo pvchange -x n /dev/mapper/crypt1
#And now I must resize the filesystem
sudo e2fsck -f /dev/mapper/PCrevisie-root
sudo resize2fs -p /dev/mapper/PCrevisie-root
If I'm getting somewhere wrong will be very nice to get some assist.