[root@instructor ~]# umount /dev/dywvg/dywlv [root@instructor ~]# resize2fs -f /dev/dywvg/dywlv 900M resize2fs 1.41.12 (17-May-2010) Resizing the filesystem on /dev/dywvg/dywlv to 230400 (4k) blocks. The filesystem on /dev/dywvg/dywlv is now 230400 blocks long. [root@instructor ~]# fsck /dev/mapper/dywvg-dywlv fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010) /dev/mapper/dywvg-dywlv: clean, 2956/79680 files, 22474/311296 blocks [root@instructor ~]# lvresize -L 900M /dev/dywvg/dywlv Rounding up size to full physical extent 928.00 MiB WARNING: Reducing active logical volume to 928.00 MiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce dywlv? [y/n]: y Reducing logical volume dywlv to 928.00 MiB Logical volume dywlv successfully resized [root@instructor ~]# mount /dev/dywvg/dywlv /mnt/dywlvm/ [root@instructor ~]# df -h /mnt/dywlvm/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/dywvg-dywlv 885M 68M 776M 9% /mnt/dywlvm [root@instructor ~]# ll /mnt/dywlvm/ total 16 drwxr-xr-x. 125 root root 12288 Jul 11 08:17 etc drwx------. 2 root root 4096 Jul 10 21:45 lost+found
[root@instructor ~]# lvresize -L 1200M /dev/dywvg/dywlv Rounding up size to full physical extent 1.19 GiB Extending logical volume dywlv to 1.19 GiB Logical volume dywlv successfully resized [root@instructor ~]# resize2fs -f /dev/dywvg/dywlv resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/dywvg/dywlv is mounted on /mnt/dywlvm; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/dywvg/dywlv to 311296 (4k) blocks. The filesystem on /dev/dywvg/dywlv is now 311296 blocks long. [root@instructor ~]# df -h /mnt/dywlvm/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/dywvg-dywlv 1.2G 69M 1.1G 6% /mnt/dywlvm [root@instructor ~]# ll /mnt/dywlvm/ total 16 drwxr-xr-x. 125 root root 12288 Jul 11 08:17 etc drwx------. 2 root root 4096 Jul 10 21:45 lost+found
[root@kvm8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_kvmusb-root
1.1G 708M 321M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 93M 26M 63M 29% /boot
/dev/mapper/vg_kvmhome-vo
20M 4.6M 14M 25% /home
[root@kvm8 ~]# lvresize -L 90M -r /dev/mapper/vg_kvmhome-vo
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/mapper/vg_kvmhome-vo is mounted.
WARNING!!! The filesystem is mounted. If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.
Do you really want to continue (y/n)? yes
/dev/mapper/vg_kvmhome-vo: recovering journal
/dev/mapper/vg_kvmhome-vo: clean, 11/6144 files, 5404/20480 blocks
Extending logical volume vo to 90.00 MiB
Logical volume vo successfully resized
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/dm-2 is mounted on /home; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/dm-2 to 92160 (1k) blocks.
The filesystem on /dev/dm-2 is now 92160 blocks long.
[root@kvm8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_kvmusb-root
1.1G 708M 321M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 93M 26M 63M 29% /boot
/dev/mapper/vg_kvmhome-vo
87M 5.6M 78M 7% /home
[root@kvm8 ~]# umount /dev/mapper/vg_kvmhome-vo
[root@kvm8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_kvmusb-root
1.1G 708M 321M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 93M 26M 63M 29% /boot
[root@kvm8 ~]# lvresize -L 20M -r /dev/mapper/vg_kvmhome-vo
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/mapper/vg_kvmhome-vo: clean, 11/24576 files, 8758/92160 blocks
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/dm-2 to 20480 (1k) blocks.
The filesystem on /dev/dm-2 is now 20480 blocks long.
Reducing logical volume vo to 20.00 MiB
Logical volume vo successfully resized
[root@kvm8 ~]# mount -a
[root@kvm8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_kvmusb-root
1.1G 708M 321M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 93M 26M 63M 29% /boot
/dev/mapper/vg_kvmhome-vo
20M 4.6M 14M 25% /home
[root@instructor ~]# fdisk -c /dev/sda
Command (m for help): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 17 131072 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 17 4096 32768000 8e Linux LVM
/dev/sda3 4096 6646 20480000 8e Linux LVM
/dev/sda4 6646 60802 435006464 5 Extended
/dev/sda5 6646 7952 10485760 83 Linux
/dev/sda6 7952 10563 20979362 8e Linux LVM
/dev/sda7 10564 11869 10490413+ 8e Linux LVM
/dev/sda8 11870 12001 1060258+ 8e Linux LVM
/dev/sda9 12002 12133 1060258+ 8e Linux LVM
Command (m for help): n
First cylinder (12134-60802, default 12134):
Using default value 12134
Last cylinder, +cylinders or +size{K,M,G} (12134-60802, default 60802): +2G
Command (m for help): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 17 131072 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 17 4096 32768000 8e Linux LVM
/dev/sda3 4096 6646 20480000 8e Linux LVM
/dev/sda4 6646 60802 435006464 5 Extended
/dev/sda5 6646 7952 10485760 83 Linux
/dev/sda6 7952 10563 20979362 8e Linux LVM
/dev/sda7 10564 11869 10490413+ 8e Linux LVM
/dev/sda8 11870 12001 1060258+ 8e Linux LVM
/dev/sda9 12002 12133 1060258+ 8e Linux LVM
/dev/sda10 12134 12395 2104483+ 83 Linux
Command (m for help): t
Partition number (1-10): 10
Hex code (type L to list codes): 8e
Changed system type of partition 10 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 17 131072 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 17 4096 32768000 8e Linux LVM
/dev/sda3 4096 6646 20480000 8e Linux LVM
/dev/sda4 6646 60802 435006464 5 Extended
/dev/sda5 6646 7952 10485760 83 Linux
/dev/sda6 7952 10563 20979362 8e Linux LVM
/dev/sda7 10564 11869 10490413+ 8e Linux LVM
/dev/sda8 11870 12001 1060258+ 8e Linux LVM
/dev/sda9 12002 12133 1060258+ 8e Linux LVM
/dev/sda10 12134 12395 2104483+ 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.
[root@instructor ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
device-mapper: remove ioctl failed: Device or resource busy
device-mapper: remove ioctl failed: Device or resource busy
Warning: parted was unable to re-read the partition table on /dev/mapper/GLSguest-demo-real (Device or resource busy). This means Linux won't know anything about the modifications you made.
[root@instructor ~]# reboot
[root@instructor ~]# fdisk -l /dev/sda
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 17 131072 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 17 4096 32768000 8e Linux LVM
/dev/sda3 4096 6646 20480000 8e Linux LVM
/dev/sda4 6646 60802 435006464 5 Extended
/dev/sda5 6646 7952 10485760 83 Linux
/dev/sda6 7952 10563 20979362 8e Linux LVM
/dev/sda7 10564 11869 10490413+ 8e Linux LVM
/dev/sda8 11870 12001 1060258+ 8e Linux LVM
/dev/sda9 12002 12133 1060258+ 8e Linux LVM
/dev/sda10 12134 12395 2104483+ 8e Linux LVM
[root@instructor ~]# pvscan
PV /dev/sda8 VG dywvg lvm2 [1.00 GiB / 0 free]
PV /dev/sda9 VG dywvg lvm2 [1.00 GiB / 832.00 MiB free]
PV /dev/sda3 VG GLSguest lvm2 [19.50 GiB / 5.00 GiB free]
PV /dev/sda2 VG GLSvg lvm2 [31.22 GiB / 0 free]
PV /dev/sda6 VG GLSvg lvm2 [20.00 GiB / 6.44 GiB free]
PV /dev/sda7 VG GLSvg lvm2 [10.00 GiB / 10.00 GiB free]
Total: 6 [82.72 GiB] / in use: 6 [82.72 GiB] / in no VG: 0 [0 ]
[root@instructor ~]# pvcreate /dev/sda10
Physical volume "/dev/sda10" successfully created
[root@instructor ~]# pvscan
PV /dev/sda8 VG dywvg lvm2 [1.00 GiB / 0 free]
PV /dev/sda9 VG dywvg lvm2 [1.00 GiB / 832.00 MiB free]
PV /dev/sda3 VG GLSguest lvm2 [19.50 GiB / 5.00 GiB free]
PV /dev/sda2 VG GLSvg lvm2 [31.22 GiB / 0 free]
PV /dev/sda6 VG GLSvg lvm2 [20.00 GiB / 6.44 GiB free]
PV /dev/sda7 VG GLSvg lvm2 [10.00 GiB / 10.00 GiB free]
PV /dev/sda10 lvm2 [2.01 GiB]
Total: 7 [84.73 GiB] / in use: 6 [82.72 GiB] / in no VG: 1 [2.01 GiB]
[root@instructor ~]# vgextend dywvg /dev/sda10
Volume group "dywvg" successfully extended
[root@instructor ~]# pvscan
PV /dev/sda8 VG dywvg lvm2 [1.00 GiB / 0 free]
PV /dev/sda9 VG dywvg lvm2 [1.00 GiB / 832.00 MiB free]
PV /dev/sda10 VG dywvg lvm2 [2.00 GiB / 2.00 GiB free]
PV /dev/sda3 VG GLSguest lvm2 [19.50 GiB / 5.00 GiB free]
PV /dev/sda2 VG GLSvg lvm2 [31.22 GiB / 0 free][root@instructor ~]# vgdisplay
--- Volume group ---
VG Name dywvg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 19
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 3
Act PV 3
VG Size 4.00 GiB
PE Size 32.00 MiB
Total PE 128
Alloc PE / Size 38 / 1.19 GiB
Free PE / Size 90 / 2.81 GiB
VG UUID UztTCr-6SxE-x3eL-SR4P-fSEp-yswl-awaCJg
PV /dev/sda6 VG GLSvg lvm2 [20.00 GiB / 6.44 GiB free]
PV /dev/sda7 VG GLSvg lvm2 [10.00 GiB / 10.00 GiB free]
Total: 7 [84.72 GiB] / in use: 7 [84.72 GiB] / in no VG: 0 [0 ]
[root@instructor ~]# pvmove /dev/sda8 /dev/sda10 /dev/sda8: Moved: 6.2% /dev/sda8: Moved: 65.6% /dev/sda8: Moved: 100.0% [root@instructor ~]# vgreduce dywvg /dev/sda8 Removed "/dev/sda8" from volume group "dywvg" [root@instructor ~]# pvscan PV /dev/sda9 VG dywvg lvm2 [1.00 GiB / 832.00 MiB free] PV /dev/sda10 VG dywvg lvm2 [2.00 GiB / 1.00 GiB free] PV /dev/sda3 VG GLSguest lvm2 [19.50 GiB / 5.00 GiB free] PV /dev/sda2 VG GLSvg lvm2 [31.22 GiB / 0 free] PV /dev/sda6 VG GLSvg lvm2 [20.00 GiB / 6.44 GiB free] PV /dev/sda7 VG GLSvg lvm2 [10.00 GiB / 10.00 GiB free] PV /dev/sda8 lvm2 [1.01 GiB] Total: 7 [84.73 GiB] / in use: 6 [83.72 GiB] / in no VG: 1 [1.01 GiB] [root@instructor ~]# pvremove /dev/sda8 Labels on physical volume "/dev/sda8" successfully wiped [root@instructor ~]# pvscan PV /dev/sda9 VG dywvg lvm2 [1.00 GiB / 832.00 MiB free] PV /dev/sda10 VG dywvg lvm2 [2.00 GiB / 1.00 GiB free] PV /dev/sda3 VG GLSguest lvm2 [19.50 GiB / 5.00 GiB free] PV /dev/sda2 VG GLSvg lvm2 [31.22 GiB / 0 free] PV /dev/sda6 VG GLSvg lvm2 [20.00 GiB / 6.44 GiB free] PV /dev/sda7 VG GLSvg lvm2 [10.00 GiB / 10.00 GiB free] Total: 6 [83.72 GiB] / in use: 6 [83.72 GiB] / in no VG: 0 [0 ] [root@instructor ~]# ll /mnt/dywlvm/ total 16 drwxr-xr-x. 125 root root 12288 Jul 11 08:17 etc drwx------. 2 root root 4096 Jul 10 21:45 lost+found
2015-04-13