Linux – Using LVM to extend 2TB diskd on a linux VM

linuxlvmvmware-esxi

Currently have mounted on one of my web servers a linux box on VMware with two external drives in. These are both 2TB drives which is the limit to what you can add into VMware. I want to use lvm to extend sdc1 to get this to 5TB.

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        19G   15G  3.5G  81% /
udev             24G  4.0K   24G   1% /dev
tmpfs           9.5G  300K  9.5G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             24G     0   24G   0% /run/shm
/dev/sdc1       2.0T  1.3T  657G  66% /mnt/sdc1
/dev/sdb1       2.0T  199M  1.9T   1% /mnt/sdb1

I plan to add another 2 disks via VMware into the VM but I'm not 100% percent on the best method to achieve this?

ls -al /dev/sdc*

Find the new partition number for sdc

pvdisplay

to see if its there

vgcreate VolGroup /dev/sdc2

I'm not sure how to get the VolGroup inoformation?

lvdisplay

Get the new path

lvcreate -L??GB -n root_new VolGroup?

to assign logical size and create a new logical volume

lvextend /dev/mapper/?? /dev/sdc2 

extend the root partition

lvdisplay 

Check if any difference in size

resize2fs /dev/mapper/VolGroup-lv_root 

Resize the partition

df -h

Check if working

I suppose I'm not sure if the steps are right? How to get the volume group? And if this is the best method

Cheers

Added: fdisk -l

Disk /dev/sdb: 2147.5 GB, 2147483648000 bytes
89 heads, 61 sectors/track, 772573 cylinders, total 4194304000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bf21c23

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  4194303999  2097150976   83  Linux

Disk /dev/sdc: 2179.7 GB, 2179695902720 bytes
153 heads, 49 sectors/track, 567856 cylinders, total 4257218560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5a098214

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048  4257218559  2128608256   83  Linux

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00081a14

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    39845887    19921920   83  Linux
/dev/sda2        39847934    41940991     1046529    5  Extended
/dev/sda5        39847936    41940991     1046528   82  Linux swap / Solaris

Best Answer

I will put this as the answer. The best thing to do here is backup the data. Remove sdc1 and recreate LVM LV consisted of new 3 physical volumes. You can also try to use mdadm to stripe 3 disks with linear(0.9) metadata, almost like raid0.

The most dangerous option you can do what you want on the existing setup using this tool

"LVMIFY" - https://github.com/g2p/lvmify#readme

But you have to be very careful and be do a backup or snapshot before you proceed.

Related Topic