You are not logged in.

#1 2014-11-18 20:47:23

hasdf
Member
Registered: 2014-11-18
Posts: 7

[Solved] Enlarge logical Volume (LVM on Luks)

I moved my whole system to a new SSD which is bigger than the old one, now I need to enlarge the root partition.

sda3 is my LUKS encrypted partition.

lsblk:

NAME                    MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                       8:0    0 74,5G  0 disk  
├─sda1                    8:1    0    2M  0 part  
├─sda2                    8:2    0  200M  0 part  /boot
└─sda3                    8:3    0 29,6G  0 part  
  └─MyStorage           254:0    0 29,6G  0 crypt 
    ├─MyStorage-swapvol 254:1    0    1G  0 lvm   [SWAP]
    └─MyStorage-rootvol 254:2    0 28,6G  0 lvm   /

How can I resize sda3, MyStorage and Mystorage-rootvol without loosing data?

I found a post in the ubuntu-Wiki, but didn't quite understand Step 3.

Thanks in advance

Last edited by hasdf (2014-11-23 17:17:38)

Offline

#2 2014-11-18 21:03:44

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: [Solved] Enlarge logical Volume (LVM on Luks)

1) Enlarge physical partition (fdisk)*
2) Enlarge physical volume (pvresize)
3) Enlarge logical volume (lvresize/lvextend)
4) Enlarge filesystem (resize2fs)

* This step includes deleting the physical partition in question, so make sure you have a valid backup of your files.

Offline

#3 2014-11-18 22:32:54

hasdf
Member
Registered: 2014-11-18
Posts: 7

Re: [Solved] Enlarge logical Volume (LVM on Luks)

bstaletic wrote:

1) Enlarge physical partition (fdisk)*

* This step includes deleting the physical partition in question, so make sure you have a valid backup of your files.

Does this step delete all data on the partition or may it delete all data?

Offline

#4 2014-11-18 22:44:59

frostschutz
Member
Registered: 2013-11-15
Posts: 1,637

Re: [Solved] Enlarge logical Volume (LVM on Luks)

Is there free space on the disk to make that partition larger?

parted /dev/sda unit s print free

If so, you should be able to enlarge the partition using any partitioner of your choice. It's important that the starting offset of the partition does not change.

After rebooting, you can resize the PV (pvresize /dev/mapper/luksdevice) and subsequently create or extend LV (lvcreate or lvextend) as well as filesystem (resize2fs, xfs_growfs, etc.) to use the new space.

Last edited by frostschutz (2014-11-18 22:48:02)

Offline

#5 2014-11-18 23:15:26

hasdf
Member
Registered: 2014-11-18
Posts: 7

Re: [Solved] Enlarge logical Volume (LVM on Luks)

frostschutz wrote:

Is there free space on the disk to make that partition larger?

If I got you right, there is free space after the partition:

Modell: ATA INTEL SSDSA2M080 (scsi)
Festplatte  /dev/sda:  156301488s
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt
Disk-Flags: 

Nummer  Anfang     Ende        Größe      Dateisystem   Name  Flags
        34s        2047s       2014s      Freier Platz
 1      2048s      6143s       4096s
 2      6144s      415743s     409600s    ext2
 3      415744s    62533262s   62117519s
        62533263s  156301454s  93768192s  Freier Platz

Thank you for your help! I'll try it and post the result here.

EDIT: I coudn't enlarge the partition like frostschulz said. And since I had to delete the partition in question, I just deleted everything and reinstalled archlinux with a full system backup.

Last edited by hasdf (2014-11-23 17:15:07)

Offline

Board footer

Powered by FluxBB