IMPORTANT: Before you begin any disk changes create FULL backup of your server
Create new one
fdisk -l
fdisk /dev/sdc
- p n p 4 Enter Enter Enter p (to change type press "t", enter "L", "8e" for LVM) p w (write)
reboot
pvdisplay
pvcreate /dev/sdc1
pvdisplay
vgdisplay
vgcreate vg_monitor /dev/sdc1
vgextend vg_monitor /dev/sdc1
pvs
lvcreate -L 349g -n u03 vg_monitor
(!) Danger (!)
mkfs.ext4 /dev/vg_monitor/u03
vi /etc/fstab
/dev/vg_monitor/u03 /u03 ext4 defaults 2 1
mkdir /u03
mount /u03
df -h
reboot
df -h
/dev/mapper/vg_monitor-u03 345G 96G 232G 30% /u03
/u01/app/oracle/product/11.2.0/dbhome_1/bin
Extend Disk Space (Logical Volume), Vmware, Oracle Linux 7.1 - Extend: PV, VG, LV, FS
Research current configuration:
- if all volume of vmware's hdd sown in the Linux OS (df -h)
- how many volumes exists /dev/sdX? If you have /dev/sd4, it is the maximum quantity of primary disks
df -h check current disk's sizes (46.57G)
pvdisplay
vgdisplay
lvdisplay
Add space in the VMvare's console
df -h no space added
fdisk -l we see, that disk /dev/sda become more and there're three devices on it /dev/sda1 /dev/sda2 /dev/sda3
fdisk /dev/sda p n p 4 Enter Enter Enter p (if we wish to change type press "t", then "L" and "8e" for LVM) w (write)
fdisk -l new device should be /dev/sda4, with bigger size which we added
reboot or use this commands to rescan w/o reboot*
a) If added new disk
ls /sys/class/scsi_host
echo "- - -" > /sys/class/scsi_host/host#/scan
b) If increased disk size
ls /sys/class/scsi_device/
echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
pvdisplay nothing
pvcreate /dev/sda4 successfully
reboot
pvdisplay
pvresize /dev/sda4 it needs when we deleted partition in the fdisk and recreated if with bigger size
pvdisplay new device exists /dev/sda4
vgdisplay also has new hew device
vgextend vg_oel6 /dev/sda4 successfully, vg_oel6 is Voluve Group Name (vdextend ol /dev/sda3)
vgdisplay shows free space: Free PE / Size 51199 / 200,00 GiB
lvdisplay vg_oel6 with path at /dev/vg_oel6_root (where we want to add space). Note it size «new physical volume»
pvscan shows all physical volumes
lvextend -L +4.99G /dev/vg_oel6/lv_root /dev/sda4 successfully resized (lvextend -L +19,99G /dev/ol/u01 lvextend -r -l+100%FREE /dev/ol/u01)
mount |grep /dev check filesystem type (ext or xfs, for example)
resize2fs /dev/vg_oel6/lv_root 51.56G 51.56G full size of the disk, or use for xfs
xfs_growfs /dev/vg_u02/u02 for the filesystem
Possible error: Couldn't find valid filesystem superblock
pvs shows correct size, also shows free amount of space
vgs
lvs
Deleting a Logical Volume
umount /mnt/lvstuff
lvremove /dev/vgpool/lvstuff
vgremove vgpool
pvremove /dev/sdb1 /dev/sdc1