Installation Disks Setup Extension - kwantu/platformconfiguration GitHub Wiki

back...

Setup new server disks

https://www.howtoforge.com/linux_lvm

First use LVM to create Physical volumes of the disk drives

View the physical volumes on the devices attached to the server

 fdisk -l

>>>

/dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
/dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
/dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 sectors

From Afrihost these volumes would already be formatted, but you can use 

fdisk /dev/sdb

if /dev/sdb doesn't contain a valid partition table

Then prepare the drives for LVM

We need to create partitions on them

vgcreate fileserver /dev/sdb1 /dev/sdc1

>>>

WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb1.
WARNING: ext4 signature detected on /dev/sdc1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdc1.
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.

You can view the physical volumes created

pvdisplay

>>>>

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg00
  PV Size               <99.66 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25511
  Free PE               0
  Allocated PE          25511
  PV UUID               pz1xB6-9698-u20k-CKXf-Zhhh-ad4L-pdJK0a

  "/dev/sdb1" is a new physical volume of "<200.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name
  PV Size               <200.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               UsNlyT-sc5k-b39f-7RE6-lOX0-8QlQ-Kty9xy

  "/dev/sdc1" is a new physical volume of "<200.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name
  PV Size               <200.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               0FcMmk-1QJw-OpTx-Iwwu-EHUp-zxRw-4HzONz

Create a new volume group

This is not relevant for Afrihost

Adding the new physical volume to an existing volume group

First see what volume groups are already present

vgscan

>>>>
  Found volume group "vg00" using metadata type lvm2


vgdisplay

>>>>

  Reading volume groups from cache.
  Found volume group "vg00" using metadata type lvm2
[root@kwantucontrol dev]# vgdisplay
  --- Volume group ---
  VG Name               vg00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.65 GiB
  PE Size               4.00 MiB
  Total PE              25511
  Alloc PE / Size       25511 / 99.65 GiB
  Free  PE / Size       0 / 0
  VG UUID               C9WdJR-2bf7-jE8I-hwUv-OU2E-b1Mk-v98ErL

Now add the physical volumes to the existing volume group

vgextend vg00 /dev/sdb1

>>>>
  Volume group "vg00" successfully extended

vgextend vg00 /dev/sdc1
  Volume group "vg00" successfully extended

Making the space available for use: Logical volumes

Show the existing logical volumes

lvdisplay

>>>>

  --- Logical volume ---
  LV Path                /dev/vg00/lv_swap
  LV Name                lv_swap
  VG Name                vg00
  LV UUID                LxuEjc-e7Dh-YzuX-YCl8-FQUh-TQEe-58sXyJ
  LV Write Access        read/write
  LV Creation host, time centos7.dedicated.co.za, 2017-01-13 13:19:32 +0200
  LV Status              available
  # open                 2
  LV Size                <5.59 GiB
  Current LE             1431
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/vg00/root
  LV Name                root
  VG Name                vg00
  LV UUID                e2Yngq-RoEp-eKfj-n3UM-IHUc-sJNy-E4D5bi
  LV Write Access        read/write
  LV Creation host, time centos7.dedicated.co.za, 2017-01-13 13:22:35 +0200
  LV Status              available
  # open                 1
  LV Size                94.06 GiB
  Current LE             24080
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

And scan the logical volumes

lvscan

>>>>

  ACTIVE            '/dev/vg00/lv_swap' [<5.59 GiB] inherit
  ACTIVE            '/dev/vg00/root' [94.06 GiB] inherit

Then we extend by adding the new space

lvextend -r -L +400G /dev/vg00/root

>>>>

  Size of logical volume vg00/root changed from 94.06 GiB (24080 extents) to 484.06 GiB (123920 extents).
  Logical volume vg00/root successfully resized.
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/vg00-root is mounted on /; on-line resizing required
old_desc_blocks = 12, new_desc_blocks = 61
The filesystem on /dev/mapper/vg00-root is now 126894080 blocks long.