[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Online resize of gpt+cryptsetup+lvm



Le 30/10/2016 à 17:53, Ian Jackson a écrit :

When I partioned my new netbook I left myself a reasonable amount of
space unpartitioned, in case I should ever want it.  Well, of course,
then I wanted it.  Specifically, I have: SSD nvme0n1 containing GPT
partitions; nvme0n1p6 is a LUKS volume containing my main LVM PV.

I didn't want to reboot.  I thought that it should be possible to
achieve this.

Sure it is. Been there, done that.

1. Discover that none of the "friendly" partition tools would work on
   an in-use partition table.

IIRC, parted does not care about the partition being in use.

2. Use sfdisk:
     # sfdisk -d /dev/nvme0n1 >before
     # cp before after
     # emacs after &
   This part could be quite fiddly.  In my setup the free space
   was right after the partition I wanted to resize - by design.
   So all I had to do was change the right "size=" number.
   If any of the "start=" needed changing, this would all be MUCH
   harder.

Obviously. Changing the start requires to move all to contents to new start. Of course this cannot be done if the partition is in use.

3. Search the intertubes to try to figure out whether
   `cryptsetup resize' was safe to use on a running LUKS device.

Of course it is. That's what it is for. It has no use with a non running encrypted device : just resize the container, and the encrypted volume will automatically use the new size when opened.


Reply to: