Ask Your Question
2

enlarging a luks on lvm ext4 parition

asked 2016-05-08 06:58:51 -0500

jayaura gravatar image

I have a little messy setup after trying so many distros, and finally I have this (lsblk):

[jayaura@fedaura-envy ~]$ lsblk
NAME                                            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                               8:0    0 931.5G  0 disk  
├─sda1                                            8:1    0   512M  0 part  /boot/efi
├─sda2                                            8:2    0   477M  0 part  
└─sda3                                            8:3    0 930.6G  0 part  
  ├─Sytem-deb--home                             253:0    0  37.3G  0 lvm   
  │ └─luks-01e02883-4067-40d2-96bf-b187fbcad91b 253:6    0  37.3G  0 crypt /home
  ├─Sytem-neutral--buffer                       253:1    0 186.3G  0 lvm   
  ├─Sytem-neutral--swap                         253:2    0   3.7G  0 lvm   
  ├─Sytem-suse--root                            253:3    0    18G  0 lvm   
  ├─Sytem-suse--home                            253:4    0    30G  0 lvm   
  └─Sytem-root                                  253:5    0  15.9G  0 lvm   /

The other LVMs also contain LUKS stuff, which when decrypted gives me an ext4 or btrfs parition. My fedora /home is currently small, and I will have increase it soon. So how do i do it? Most references i find are using lvm on luks.

edit retag flag offensive close merge delete

Comments

bodhi.zazen gravatar imagebodhi.zazen ( 2016-05-09 13:51:39 -0500 )edit

Looks like that post assumes LVM sits on top of a crypt. My case is other way round.

jayaura gravatar imagejayaura ( 2016-05-09 23:13:53 -0500 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2016-05-09 11:05:13 -0500

genodeftest gravatar image

updated 2016-05-10 15:50:16 -0500

For resizing LVM partitions please have a look at Arch wiki on LVM resizing, man lvresize and man pvresize.

For resizing LUKS containers, please have a look at man cryptsetup, there is a command named resize.

For resizing the internal filesystem (e.g. ext4) I don't know.

You probably want (must?) do all of this offline, i.e. from another operating system like a fedora live usb installation.

EDIT: as noted below: please make backups before you attempt any of these actions.

edit flag offensive delete link more

Comments

Thank you for the response. I am little scared to attempt. LVM resizing I've done before and its okay. LUKS resize is what I'm scared of. I dont want to screw up my data. Probably I should make a simlar setup in a VM and try first.

jayaura gravatar imagejayaura ( 2016-05-09 13:33:04 -0500 )edit

And make sure you have a backup of all important data. That should reduce your fear of screwing things up.

florian gravatar imageflorian ( 2016-05-10 11:54:06 -0500 )edit
2

answered 2016-05-19 06:47:44 -0500

hindmasj gravatar image

You need to have the /home partition unmounted when you do this, so I suggest you reboot in multi-user mode and log in as root. Take a careful note of how big the current partition is and how big you want it to be, as some commands use absolute size and other use the change in size. Make sure you have taken backups and know how to restore them.

These commands worked for me when I resized an encrypted partition. Here I am taking the LV fedora-foo, adding 10G, then resizing the encrypted file system it contains, crypt-foo, to be 310G, so adding 10G to a 300G partition.

umount /dev/mapper/crypt-foo
lvextend -L +10G /dev/fedora/foo
cryptsetup resize foo
e2fsck -f /dev/mapper/crypt-foo
resize2fs /dev/mapper/crypt-foo 310G

Growing an LV is much safer then shrinking it. The thing to be careful of is avoid making the filesystem bigger than the containing LV. If this happens you can fix the FS with resize2fs but make sure you catch it before you mount it again.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-05-08 06:58:51 -0500

Seen: 601 times

Last updated: May 19 '16