6 December 2017 - john meister © 2017 - the linux meister
To add space to a DYNAMIC vdi disk in VirtualBox the steps are:
0) failed to update redhat/CentOS in default VM "dynamic vdi"
sudo yum update - not enough space... really?
1) from the HOST OS use "VBoxManage modifyhd" to resize to new size
- check settings in VirtualBox control
2) from inside the VM OS expand the LVM: physical, volume, logical
- pvs, vgs, lvs
3) create a new partition in the available space - fdisk (or parted) /dev/sda3
- "df -h"; fdisk -l ; fdisk /dev/sda ; create /dev/sda3 - REBOOT VM
4) pvcreate the physical space to hold the volume - pvcreate /dev/sda3
pvs, pvdisplay
5) vgextend the physical volume to a volume group
vgs, vgdisplay
6) lvextend the logical volume in the volume group
lvs, lvdisplay
7) resize2fs - expand the file system (bug in RH/xfs) - use xfs_growfs
YMMV - resize2fs or xfs_growfs or fsadm - RTM
8) finally patch your redhat system
sudo yum update
---------------------------------
1) FROM HOST OS: (macOSx or Linux, for windows (really?) RTM:)
sudo VBoxManage modifyhd /home/luser/VirtualBox_VMs/Centos-Lab/Centos_Lab.vdi --resize 14480
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
2) LVM (logical volume manager) overview:
PHYSICAL
pvs
pvdisplay
pvcreate
VOLUME
vgs
vgdisplay
vgextend
LOGICAL
lvs
lvdisplay
lvextend
FILESYSTEM
fdisk
df -h
resize2fs is the normal command, however RH/Centos/xfs have a bug, use xfs_growfs or fsadm
3) from the guest OS, logged in to the VM,
Centos 7 - a complete free copy of RedHat w/o registration.
first there is an "lvm" command that brings up the manager, below are the
commands within this tool displaying the PHYSICAL, VOLUME and LOGICAL
using "lvm" commands within the lvm manager:
# Script started on Sun 03 Dec 2017 11:17:05 PM PST
# ------------------------------------------------
# root@centos7-vm.localdomain [/root]
# ------------------------------------------------
# --> lvm
#
# lvm> pvdisplay
# --- Physical volume ---
# PV Name /dev/sda2
# VG Name centos_centos7-vm
# PV Size 7.51 GiB / not usable 3.00 MiB
# Allocatable yes (but full)
# PE Size 4.00 MiB
# Total PE 1922
# Free PE 0
# Allocated PE 1922
# PV UUID hsp3MF-RQSG-lnVY-f3xZ-0Qeb-frZN-Fp7ffA
#
# lvm> vgdisplay
# --- Volume group ---
# VG Name centos_centos7-vm
# 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 7.51 GiB
# PE Size 4.00 MiB
# Total PE 1922
# Alloc PE / Size 1922 / 7.51 GiB
# Free PE / Size 0 / 0
# VG UUID 4EAyOS-hEBY-x2WA-BsXc-C2mp-gb3A-CrbXl9
#
# lvm> lvdisplay
# --- Logical volume ---
# LV Path /dev/centos_centos7-vm/swap
# LV Name swap
# VG Name centos_centos7-vm
# LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
# LV Write Access read/write
# LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
# LV Status available
# # open 2
# LV Size 820.00 MiB
# Current LE 205
# Segments 1
# Allocation inherit
# Read ahead sectors auto
# - currently set to 256
# Block device 253:0
#
# --- Logical volume ---
# LV Path /dev/centos_centos7-vm/root
# LV Name root
# VG Name centos_centos7-vm
# LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
# LV Write Access read/write
# LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
# LV Status available
# # open 1
# LV Size 6.71 GiB <-----------------<<< we need space here!
# Current LE 1717
# Segments 1
# Allocation inherit
# Read ahead sectors auto
# - currently set to 256
# Block device 253:1
#
# lvm> exit
# Exiting.
# ------------------------------------------------
# root@centos7-vm.localdomain [/root]
# ------------------------------------------------
# --> exit
# exit
# Script done on Mon 04 Dec 2017 01:56:46 AM PST
##############################################################
# NORMAL CREATION OF LVM process:
# fdisk -l
# pvcreate /dev/sd?5
# pvdisplay
# vgcreate vg199 /dev/sd[c-k]5
# vgdisplay
# lvcreate -L 303400 vg199
# lvdisplay
# mkfs -t ext3 /dev/mapper/vg199-lvol0
# vi /etc/fstab
# - add: /dev/vg199/lvol0 /VG199 ext3 defaults 0 0
# mkdir /VG199
# mount -a
# df -h
#############################################################
# Extending LVM process:
# pvdisplay
# pvresize
# pvdisplay
# vgextend Add physical volumes to a volume group
# vgdisplay
# lvextend Add space to a logical volume
# lvdisplay
# increase file system - resize2fs (or when bugs are in RedHat: xfs_fsgrow)
##############################################################
# Linux LVM (logical volume commands
##############################################################
# dumpconfig Dump active configuration
# formats List available metadata formats
# help Display help for commands
# lvchange Change the attributes of logical volume(s)
# lvconvert Change logical volume layout
# lvcreate Create a logical volume
# lvdisplay Display information about a logical volume
# lvextend Add space to a logical volume
# lvmchange With the device mapper, this is obsolete and does nothing.
# lvmdiskscan List devices that may be used as physical volumes
# lvmsadc Collect activity data
# lvmsar Create activity report
# lvreduce Reduce the size of a logical volume
# lvremove Remove logical volume(s) from the system
# lvrename Rename a logical volume
# lvresize Resize a logical volume
# lvs Display information about logical volumes
# lvscan List all logical volumes in all volume groups
# pvchange Change attributes of physical volume(s)
# pvresize Resize physical volume(s)
# pvck Check the consistency of physical volume(s)
# pvcreate Initialize physical volume(s) for use by LVM
# pvdata Display the on-disk metadata for physical volume(s)
# pvdisplay Display various attributes of physical volume(s)
# pvmove Move extents from one physical volume to another
# pvremove Remove LVM label(s) from physical volume(s)
# pvs Display information about physical volumes
# pvscan List all physical volumes
# segtypes List available segment types
# vgcfgbackup Backup volume group configuration(s)
# vgcfgrestore Restore volume group configuration
# vgchange Change volume group attributes
# vgck Check the consistency of volume group(s)
# vgconvert Change volume group metadata format
# vgcreate Create a volume group
# vgdisplay Display volume group information
# vgexport Unregister volume group(s) from the system
# vgextend Add physical volumes to a volume group
# vgimport Register exported volume group with system
# vgmerge Merge volume groups
# vgmknodes Create the special files for volume group devices in /dev
# vgreduce Remove physical volume(s) from a volume group
# vgremove Remove volume group(s)
# vgrename Rename a volume group
# vgs Display information about volume groups
# vgscan Search for all volume groups
# vgsplit Move physical volumes into a new or existing volume group
# version Display software and driver version information
##############################################################
Script started on Mon 04 Dec 2017 10:40:29 PM PST
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 6.7G 5.9G 881M 88% /
devtmpfs 237M 0 237M 0% /dev
tmpfs 246M 88K 246M 1% /dev/shm
tmpfs 246M 4.7M 241M 2% /run
tmpfs 246M 0 246M 0% /sys/fs/cgroup
/dev/sda1 497M 118M 380M 24% /boot
/dev/sr0 56M 56M 0 100% /run/media/luser/VBOXADDITIONS_5.0.30_112061
luser 895G 723G 172G 81% /media/sf_luser
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 6.7G 5.9G 881M 88% /
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvs ; pvdisplay
PV VG Fmt Attr PSize PFree
/dev/sda2 centos_centos7-vm lvm2 a-- 7.51g 0
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_centos7-vm
PV Size 7.51 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1922
Free PE 0
Allocated PE 1922
PV UUID hsp3MF-RQSG-lnVY-f3xZ-0Qeb-frZN-Fp7ffA
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgs ; vgdisplay
VG #PV #LV #SN Attr VSize VFree
centos_centos7-vm 1 2 0 wz--n- 7.51g 0
--- Volume group ---
VG Name centos_centos7-vm
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
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 7.51 GiB
PE Size 4.00 MiB
Total PE 1922
Alloc PE / Size 1922 / 7.51 GiB
Free PE / Size 0 / 0
VG UUID 4EAyOS-hEBY-x2WA-BsXc-C2mp-gb3A-CrbXl9
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvs ; lvdisplay
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
root centos_centos7-vm -wi-ao---- 6.71g
swap centos_centos7-vm -wi-ao---- 820.00m
--- Logical volume ---
LV Path /dev/centos_centos7-vm/swap
LV Name swap
VG Name centos_centos7-vm
LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos_centos7-vm/root
LV Name root
VG Name centos_centos7-vm
LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 1
LV Size 6.71 GiB
Current LE 1717
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> fdisk -l
Disk /dev/sda: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
Disk /dev/mapper/centos_centos7--vm-swap: 859 MB, 859832320 bytes, 1679360 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/centos_centos7--vm-root: 7201 MB, 7201619968 bytes, 14065664 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
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> history
1 df -h
2 df -h .
3 pvs ; pvdisplay
4 vgs ; vgdisplay
5 lvs ; lvdisplay
6 fdisk -l
7 history
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> 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: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (16777216-29655039, default 16777216):
Using default value 16777216
Last sector, +sectors or +size{K,M,G} (16777216-29655039, default 29655039):
Using default value 29655039
Partition 3 of type Linux and of size 6.1 GiB is set
Command (m for help): p
Disk /dev/sda: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
/dev/sda3 16777216 29655039 6438912 83 Linux
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): L
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sda: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
/dev/sda3 16777216 29655039 6438912 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
###########################
MUST REBOOT the VM NOW
###########################
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> fdisk -l
Disk /dev/sda: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
/dev/sda3 16777216 29655039 6438912 8e Linux LVM
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> history
1 df -h
2 df -h .
3 pvs ; pvdisplay
4 vgs ; vgdisplay
5 lvs ; lvdisplay
6 fdisk -l
7 history
8 fdisk /dev/sda (REBOOT)
9 fdisk -l
10 pvcreate /dev/sda3
11 vgextend centos_centos7--vm-root /dev/sda3
12 vgs
13 vgextend centos_centos7-vm /dev/sda3
14 fdisk -l
15 history
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> exit
exit
Script done on Mon 04 Dec 2017 10:47:52 PM PST
Script started on Mon 04 Dec 2017 10:54:39 PM PST
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 6.7G 5.9G 881M 88% /
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvs; pvdisplay
PV VG Fmt Attr PSize PFree
/dev/sda2 centos_centos7-vm lvm2 a-- 7.51g 0
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_centos7-vm
PV Size 7.51 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1922
Free PE 0
Allocated PE 1922
PV UUID hsp3MF-RQSG-lnVY-f3xZ-0Qeb-frZN-Fp7ffA
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgs ; vgdisplay
VG #PV #LV #SN Attr VSize VFree
centos_centos7-vm 1 2 0 wz--n- 7.51g 0
--- Volume group ---
VG Name centos_centos7-vm
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
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 7.51 GiB
PE Size 4.00 MiB
Total PE 1922
Alloc PE / Size 1922 / 7.51 GiB
Free PE / Size 0 / 0
VG UUID 4EAyOS-hEBY-x2WA-BsXc-C2mp-gb3A-CrbXl9
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvs ; lvdisplay
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
root centos_centos7-vm -wi-ao---- 6.71g
swap centos_centos7-vm -wi-ao---- 820.00m
--- Logical volume ---
LV Path /dev/centos_centos7-vm/swap
LV Name swap
VG Name centos_centos7-vm
LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos_centos7-vm/root
LV Name root
VG Name centos_centos7-vm
LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 1
LV Size 6.71 GiB
Current LE 1717
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> fdisk -l
Disk /dev/sda: 15.2 GB, 15183380480 bytes, 29655040 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: 0x000b1988
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 16777215 7875584 8e Linux LVM
/dev/sda3 16777216 29655039 6438912 8e Linux LVM
Disk /dev/mapper/centos_centos7--vm-swap: 859 MB, 859832320 bytes, 1679360 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/centos_centos7--vm-root: 7201 MB, 7201619968 bytes, 14065664 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
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos_centos7-vm lvm2 a-- 7.51g 0
/dev/sda3 lvm2 a-- 6.14g 6.14g
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgs
VG #PV #LV #SN Attr VSize VFree
centos_centos7-vm 1 2 0 wz--n- 7.51g 0
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgextend centos_centos7-vm /dev/sda3
Volume group "centos_centos7-vm" successfully extended
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgs
VG #PV #LV #SN Attr VSize VFree
centos_centos7-vm 2 2 0 wz--n- 13.64g 6.14g <------<<<
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvscan
PV /dev/sda2 VG centos_centos7-vm lvm2 [7.51 GiB / 0 free]
PV /dev/sda3 VG centos_centos7-vm lvm2 [6.14 GiB / 6.14 GiB free]
Total: 2 [13.64 GiB] / in use: 2 [13.64 GiB] / in no VG: 0 [0 ]
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvdisplay
--- Logical volume ---
LV Path /dev/centos_centos7-vm/swap
LV Name swap
VG Name centos_centos7-vm
LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos_centos7-vm/root
LV Name root
VG Name centos_centos7-vm
LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 1
LV Size 6.71 GiB
Current LE 1717
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 6.7G 5.9G 881M 88% /
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgdisplay
--- Volume group ---
VG Name centos_centos7-vm
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 13.64 GiB
PE Size 4.00 MiB
Total PE 3493
Alloc PE / Size 1922 / 7.51 GiB
Free PE / Size 1571 / 6.14 GiB
VG UUID 4EAyOS-hEBY-x2WA-BsXc-C2mp-gb3A-CrbXl9
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvextend /dev/mapper/centos_centos7--vm-root /Kdev/sda3
Extending logical volume root to 12.84 GiB
Logical volume root successfully resized
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 6.7G 5.9G 881M 88% /
------------------------------------------------
root@centos7-vm.localdomain [/root/.History]
------------------------------------------------
--> resize2fs /dev/centos_centos7-vm/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos_centos7-vm/root
Couldn't find valid filesystem superblock.
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> resize2fs /dev/mapper/centos_centos7--vm-root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos_centos7--vm-root
Couldn't find valid filesystem superblock.
------------------------------
INSERT research time to determine the REDHAT and CENTOS have a bug... related to the xfs filesystem
web pages suggested fsadm, and other tools... I tried several, finally found one little
quiet note mentioning a rather odd command: xfs_growfs ...ok... let's see if it's here... yep...
let's see if it works... yep.
------------------------------------------------
root@centos7-vm.localdomain [/root/.History]
------------------------------------------------
--> which xfs_growfs
/sbin/xfs_growfs
------------------------------------------------
root@centos7-vm.localdomain [/root/.History]
------------------------------------------------
--> xfs_growfs /dev/centos_centos7-vm/root
meta-data=/dev/mapper/centos_centos7--vm-root isize=256 agcount=4, agsize=439552 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=1758208, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1758208 to 3366912
------------------------------------------------
root@centos7-vm.localdomain [/root/.History]
------------------------------------------------
############################################################
--> df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 13G 5.9G 7.0G 46% /
------------------------------------------------
the fix:
32 xfs_growfs /dev/centos_centos7-vm/root
--> sudo yum update
...NOW IT WORKED
############################################################
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos_centos7-vm lvm2 a-- 7.51g 0
/dev/sda3 centos_centos7-vm lvm2 a-- 6.14g 0
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgs
VG #PV #LV #SN Attr VSize VFree
centos_centos7-vm 2 2 0 wz--n- 13.64g 0
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> vgdisplay
--- Volume group ---
VG Name centos_centos7-vm
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 13.64 GiB
PE Size 4.00 MiB
Total PE 3493
Alloc PE / Size 3493 / 13.64 GiB
Free PE / Size 0 / 0
VG UUID 4EAyOS-hEBY-x2WA-BsXc-C2mp-gb3A-CrbXl9
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
root centos_centos7-vm -wi-ao---- 12.84g
swap centos_centos7-vm -wi-ao---- 820.00m
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvdisplay
--- Logical volume ---
LV Path /dev/centos_centos7-vm/swap
LV Name swap
VG Name centos_centos7-vm
LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos_centos7-vm/root
LV Name root
VG Name centos_centos7-vm
LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 1
LV Size 12.84 GiB
Current LE 3288
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvdisplay | grep "LV Path"
LV Path /dev/centos_centos7-vm/swap
LV Path /dev/centos_centos7-vm/root
------------------------------------------------
root@centos7-vm.localdomain [/root]
------------------------------------------------
--> lvs ; lvdisplay
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
root centos_centos7-vm -wi-ao---- 12.84g
swap centos_centos7-vm -wi-ao---- 820.00m
--- Logical volume ---
LV Path /dev/centos_centos7-vm/swap
LV Name swap
VG Name centos_centos7-vm
LV UUID unHZAf-2kFX-k257-bIW4-9p7f-izdp-QH651O
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos_centos7-vm/root
LV Name root
VG Name centos_centos7-vm
LV UUID VjC00k-ZBh0-4usX-29Xf-rLkm-5JyZ-44eQSF
LV Write Access read/write
LV Creation host, time localhost, 2016-09-09 07:22:26 -0700
LV Status available
# open 1
LV Size 12.84 GiB
Current LE 3288
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
------------------------------------------------
root@centos7-vm.localdomain [/root/.History]
------------------------------------------------
--> df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_centos7--vm-root 13G 5.9G 7.0G 46% /
------------------------------------------------
|