LVM
lvm2-libs-2.02.118-2.el6.x86_64
lvm2-2.02.118-2.el6.x86_64
mesa-private-llvm-3.4-3.el6.x86_64
——————————————————————————–
[root@LVM ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x0007152d
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda3 549 7833 58510336 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4):
Value out of range.
Partition number (1-4): 4
First cylinder (39-7832, default 39):
Using default value 39
Last cylinder, +cylinders or +size{K,M,G} (39-548, default 548):
Using default value 548
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x0007152d
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda3 549 7833 58510336 83 Linux
/dev/sda4 39 548 4093586 5 Extended
Partition table entries are not in disk order
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@LVM ~]# 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.
———————————————————————————-
Creating Logical Volumes using MB Size’s
[root@LVM ~]# mkdir /lvmdata
[root@LVM ~]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext=”system_u:object_r:tmpfs_t:s0″)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
[root@LVM ~]# ls -l /lvmdata/
total 0
[root@LVM ~]# mount /dev/volumegroup-name/logicalvolume-name /lvmdata/
[root@LVM ~]# ls -l /lvmdata/
total 12
drwx——. 2 root root 12288 Feb 21 18:17 lost+found
[root@LVM ~]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext=”system_u:object_r:tmpfs_t:s0″)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
/dev/mapper/volumegroup–name-logicalvolume–name on /lvmdata type ext4 (rw)
[root@LVM ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 55G 5.5G 47G 11% /
tmpfs tmpfs 358M 72K 358M 1% /dev/shm
/dev/sda1 ext4 283M 41M 228M 16% /boot
/dev/mapper/volumegroup–name-logicalvolume–name
ext4 190M 1.6M 179M 1% /lvmdata
————————————————————————————————————-
[root@LVM ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Dec 24 00:47:10 2015
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=cbc3eda3-9a23-4943-a8c4-3990addeb161 / ext4 defaults 1 1
UUID=d5b88247-f67f-4b40-9862-16826e250b78 /boot ext4 defaults 1 2
UUID=af69d0e5-b600-49a0-9228-d4195936bdd2 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/mapper/volumegroup–name-logicalvolume–name /lvmdata ext4 defaults 0 0
———————————————————————————————————–
[root@LVM ~]# reboot
[root@LVM ~]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext=”system_u:object_r:tmpfs_t:s0″)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/volumegroup–name-logicalvolume–name on /lvmdata type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
——————————————————————————————
[root@LVM ~]# lvdisplay
— Logical volume —
LV Path /dev/volumegroup-name/logicalvolume-name
LV Name logicalvolume-name
VG Name volumegroup-name
LV UUID H2CqM4-9mLm-i5d5-20Im-ZZj5-fWR0-ZMJHVQ
LV Write Access read/write
LV Creation host, time LVM, 2016-02-21 18:15:16 -0800
LV Status available
# open 1
LV Size 200.00 MiB
Current LE 50
Segments 2
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0
[root@LVM ~]# lvextend –size 300M /dev/volumegroup-name/logicalvolume-name
Size of logical volume volumegroup-name/logicalvolume-name changed from 200.00 MiB (50 extents) to 300.00 MiB (75 extents).
Logical volume logicalvolume-name successfully resized
[root@LVM ~]# lvdisplay
— Logical volume —
LV Path /dev/volumegroup-name/logicalvolume-name
LV Name logicalvolume-name
VG Name volumegroup-name
LV UUID H2CqM4-9mLm-i5d5-20Im-ZZj5-fWR0-ZMJHVQ
LV Write Access read/write
LV Creation host, time LVM, 2016-02-21 18:15:16 -0800
LV Status available
# open 1
LV Size 300.00 MiB
Current LE 75
Segments 3
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0
[root@LVM ~]# lvremove /dev/mapper/volumegroup–name-logicalvolume–name
Logical volume volumegroup-name/logicalvolume-name contains a filesystem in use.
[root@LVM ~]# umount /lvmdata/
[root@LVM ~]# lvremove /dev/mapper/volumegroup–name-logicalvolume–name
Do you really want to remove active logical volume logicalvolume-name? [y/n]: y
Logical volume “logicalvolume-name” successfully removed
[root@LVM ~]# lvdisplay
[root@LVM ~]#
—————————————————————————————————
[root@LVM ~]# vgdisplay
— Volume group —
VG Name volumegroup-name
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 320.00 MiB
PE Size 4.00 MiB
Total PE 80
Alloc PE / Size 0 / 0
Free PE / Size 80 / 320.00 MiB
VG UUID Chs0rl-ZfV0-D2WQ-4D2X-Jnt0-UUaJ-2vjBpD
———————————
[root@LVM ~]# vgreduce volumegroup-name /dev/sda7
Removed “/dev/sda7” from volume group “volumegroup-name”
[root@LVM ~]# vgdisplay
— Volume group —
VG Name volumegroup-name
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 212.00 MiB
PE Size 4.00 MiB
Total PE 53
Alloc PE / Size 0 / 0
Free PE / Size 53 / 212.00 MiB
VG UUID Chs0rl-ZfV0-D2WQ-4D2X-Jnt0-UUaJ-2vjBpD
[root@LVM ~]# vgextend volumegroup-name /dev/sda8
———————————————————————————–
[root@LVM ~]# vgextend volumegroup-name /dev/sda8
