0

we have linux OS with OS - sda and another disk for data

 df
Filesystem               1K-blocks     Used Available Use% Mounted on
/dev/mapper/vg55-lvm_root  41932800 19731580  22201220  48% /
devtmpfs                  16372376        0  16372376   0% /dev
tmpfs                     16387592      108  16387484   1% /dev/shm
tmpfs                     16387592  1741416  14646176  11% /run
tmpfs                     16387592        0  16387592   0% /sys/fs/cgroup
/dev/mapper/vg55-lvm_var  105756672 54652856  51103816  52% /var
/dev/sdb                  72117368 72100984         0 100% /data
/dev/sda1                   508588   160024    348564  32% /boot

  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda2  vg55 lvm2 a--  149.51g 92.00m
#

the problem is that /data is full , and we want to add another new disk from the VMcenter in order to extend the sdb disk to 200G

please advice how to perfrom the steps

  • Well, you can't extend the size of sdb by adding another disk because that other disk would become sdX. But if sdb is really a virtual disk, you can increase its size with your virtualization tools and then within the OS extend the partition and filesystem, adding the additional space to /data. I'm not sure how this is related to LVM given that /data is not an LVM logical volume, but rather a disk. Clarification would be appreciated. – Emmanuel Rosa Jul 30 '18 at 10:01
  • what are the LVM commands for increase sdb ? – yael Jul 30 '18 at 10:03
  • Yael, sdb is not an LVM logical volume, so the LVM commands do not apply. If sdb is actually a virtual disk (I can't tell from your post) you can increase its size with VMware. See pubs.vmware.com/fusion-5/… – Emmanuel Rosa Jul 30 '18 at 10:07
1

It seems that /data is not managed with LVM so you might add space so /dev/sdb via vCenter and then grow the file system in CentOs

xfs_growfs /dev/sdb

LVM

If you want to have LVM for /data, that will be a bit longer.

Add the disk to VMware, make it show in CentOS :

List host bus numbers :

ls /sys/class/scsi_host/  

For each host bus, scan the bus (where [hostX] is the name you get from the previous command):

echo "- - -" > /sys/class/scsi_host/[hostX]/scan

Check the names of your SCSI devices

ls /sys/class/scsi_device/

Rescan the SCSI buses (name are in form X:X:X:X)

echo 1 > /sys/class/scsi_device/X\:X\:X\:X/device/rescan

Then you can fdisk -l to see your disk

First, you need to create a new Physical Volume with the new disk.

I assume that the disk will be sdc.

pvcreate /dev/sdc

Then you can create a new VG or use the existing one :

I assume you'll use the existing one :

vgextend vg55 /dev/sdc

You need to create a Logical Volume to use now

lvcreate -L200G -n lvm_data vg55

You now need to create a filesystem on this volume

mkfs.xfs /dev/mapper/vg55-lvm_data

You now have a 200GB disk that can be mounted. You might mount lvm_data somewhere, copy /data to the new volume, unmount /data and the lvm_data, and mount /dev/mapper/vg55-lvm_data /data.

To add /dev/sdb to the LVM (if needed).

Once you have your date moved elsewhere :

pvcreate /dev/sdb

Confirm you want to wipe the filesystem on /dev/sdb with y

Add /dev/sdb to the existing VG

vgextend vg55 /dev/sdb

Then you can allocate that space to the lv you want with

lvextend -L68G /dev/vg55/data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.