0

I have a dedicated server which I will use to build virtual machines on top of using KVM (thank you, Virtualizor), the problem is, I do not physical access to the machine as it is rented from a big company, and I need to figure out how to group the 2 storage to make them 1 volume, I can change the system if someone believes that one can be easier than other to manage the volume groups, I have this options of operating systems (that virtualizor supports and the dedicated provider allows: CentOS 7 or Ubuntu 16.04(x86_64) and the machine has 2 SSDs of 960GB

the problems I am facing (I am currently on CentOS 7) are: 1- as I am using one disk I don't know how to manage it while using it 2- the root has almost all space of one disk, which gives 60MB left 3- I have no idea how to set them in one single volume group

I believe I understood the part of the documentation on how to reduce the root size, but if you can more clearly describe the process, steps and what the steps do I sincerely appreciate. So, if I can reduce the root size the only thing left will be to merge the 2 disks into one volume group, I have tried to extend it but I might have missed something IDK

[root@server]# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): p

Disk /dev/sda: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos Disk identifier: 0x00023b47

Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux

[root@server]# vgs VG #PV #LV #SN Attr VSize VFree vg 1 3 0 wz--n- 894.25g 60.00m

[root@server]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg-root 876G 3.0G 828G 1% / devtmpfs 63G 0 63G 0% /dev tmpfs 63G 0 63G 0% /dev/shm tmpfs 63G 9.6M 63G 1% /run tmpfs 63G 0 63G 0% /sys/fs/cgroup /dev/sda1 1008M 143M 815M 15% /boot /dev/mapper/vg-tmp 976M 2.6M 907M 1% /tmp tmpfs 13G 0 13G 0% /run/user/0

[root@server]# pvdisplay --- Physical volume --- PV Name /dev/sdb1 VG Name vg PV Size 894.25 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 228928 Free PE 15 Allocated PE 228913 PV UUID kytvOh-HaSm-OOo3-l7OM-nbkk-QyQf-Mx1gCu

[root@server]# pvscan PV /dev/sdb1 VG vg lvm2 [894.25 GiB / 60.00 MiB free] Total: 1 [894.25 GiB] / in use: 1 [894.25 GiB] / in no VG: 0 [0 ]

[root@server]# fdisk -l

Disk /dev/sdb: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos Disk identifier: 0x0001c70b

Device Boot Start End Blocks Id System /dev/sdb1 2048 1875384319 937691136 8e Linux LVM

Disk /dev/sda: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos Disk identifier: 0x00023b47

Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux

Disk /dev/mapper/vg-root: 954.8 GB, 954762002432 bytes, 1864769536 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 /dev/mapper/vg-swap: 4294 MB, 4294967296 bytes, 8388608 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 /dev/mapper/vg-tmp: 1073 MB, 1073741824 bytes, 2097152 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

  • Do to want extend existing volume group or create redundancy ? – mrc02_kr Oct 18 '18 at 18:28
  • @mrc02_kr I want to extend, so instead of 2 960 I would have 1 volume that I can use and the volume would save on both disks. It is for personal use, so I will care about redundancy for data safety later, right now I am trying to glue to 2 into 1 volume so I can manage it easier – Igor Marcos Oct 18 '18 at 19:46
0

The first thing you have to do it to create new partition on /dev/sda device. Let's assume you will create /dev/sda2. You can do it using this commands:

fdisk /dev/sda
n - to create new partition
t -> 8e - to change partition type to Linux LVM
w - to write changes and exit

Then to have to let kernel know that new partition is created:

partprobe /dev/sda2

This commands will initialize /dev/sda2 partition for LVM, and add them to existing volume group:

pvcreate /dev/sda2
vgextend vg /dev/sda2

Then you can extend existing logical volumes or create new ones using lvextend or lvcreate. You can create few types of Logical Volumes: linear, stripped, RAID. It's up to you how you will use your space.

If you choose to extend the existing LV you have to also resize filesystem (xfs_growfs or resize2fs for EXT). If you choose to create new LV you have to create filesystem on it using mkfs command.

  • thank you very much, I could indeed create one volume, tough, now on the Virtualizor panel I see only 893.31 GB available, I think this is because the root file system holds everything by itself, I saw a chart while reading about, I know the drives are empty, it is a fresh install, so, next question is, how to give more available space since it has but shows as not possible to use for some reason – Igor Marcos Oct 18 '18 at 20:01
  • Probably XFS reserved some space for inodes. You can read about it in many questions on unix.stackexchange – mrc02_kr Oct 18 '18 at 20:12
  • I am trying to shrink the root but I don't think it is possible while using it – Igor Marcos Oct 18 '18 at 20:27

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.