1

I have installed Proxmox on a machine. I need to extend /dev/mapper/pve-data with the unused space of /dev/sdb5

How can I achieve this?

fdisk -l

Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xfbd89a5c

Device     Boot    Start       End   Sectors  Size Id Type
/dev/sda1  *        4096  40962047  40957952 19.5G 83 Linux
/dev/sda2       40962048  43057151   2095104 1023M 82 Linux swap / Solaris
/dev/sda3       43057152 468854783 425797632  203G  f W95 Ext'd (LBA)
/dev/sda5       43059200 468854783 425795584  203G 8e Linux LVM

Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xafd793e2

Device     Boot    Start       End   Sectors  Size Id Type
/dev/sdb1           4096  40962047  40957952 19.5G fd Linux raid autodetect
/dev/sdb2       40962048  43057151   2095104 1023M 82 Linux swap / Solaris
/dev/sdb3       43057152 468854783 425797632  203G  f W95 Ext'd (LBA)
/dev/sdb5       43059200 468854783 425795584  203G fd Linux raid autodetect

Disk /dev/mapper/pve-data: 199 GiB, 213708177408 bytes, 417398784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

1 Answer 1

2

Interesting information in the question would be the output from pvs, vgs and lvs.

But if I take a few cautious guesses I would guess your VG is named pve, and your lv is data. The current physical volume is /dev/sda5, and you use the complete partition as your logical volume data. I also assume that /dev/sdb5 doesn't contain any data, so we don't risk losing anything?

I would start by changing the partition type of /dev/sdb5 from Linux raid autodetect to Linux LVM.

You do this with fdisk.

# fdisk /dev/sdb
Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)
Command (m for help): w

Then you use pvcreate to make a new physical volume:

# pvcreate /dev/sdb5

You should now have 2 physical volumes listed when you type pvs

# pvs
PV         VG        Fmt  Attr PSize  PFree
/dev/sda5  pve       lvm2 a--  xx.xxg xx.00m
/dev/sdb5            lvm2 a--  xx.xxg xx.00m

Next step is to add the new physical volume into your Volume Group, pve. You do this by extending the Volume Group, by /dev/sdb5, with vgextend.

# vgextend pve /dev/sdb5

If you list information about your Volume Groups with vgs now you should see you have free space of the amount of the size of /dev/sdb5

# vgs
VG        #PV #LV #SN Attr   VSize  VFree
pve       1   1   0 wz--n- xx.xxg xx.00m

To extend the logical volume data, you use the command lvextend. If you wish to use all of the available free space you can do it like this:

lvextend -rl +100%FREE pve/data

Of if you only wish to extend it with some of the space available, you can do it like this:

lvextend -rL +50G pve/data

The -r option resizes the file system for you, so you don't have to do that manually after.

2
  • That looks like it'll work. Make a backup first!!!
    – ppetraki
    Oct 17, 2016 at 18:42
  • Thanks that did the job! Except lvexpand should be lvextend
    – Toodarday
    Oct 17, 2016 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .