LVM管理体系(三)通过扩展VG扩展逻辑卷(操作步骤)
2014-04-16 00:50
477 查看
一、离线逻辑卷
[root@instructor Desktop]#umount /dev/testvg/testlv
[root@instructor Desktop]# mount
/dev/mapper/GLSvg-GLSroot 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/GLSvg-GLShome on /home type ext4 (rw)
/dev/mapper/GLSvg-GLStmp on /tmp type ext4 (rw)
/dev/sda5 on /usr/local/share/gls/GLSINST type ext4 (ro)
/dev/mapper/GLSvg-GLSvar on /var type ext4 (rw)
/dev/mapper/GLSvg-GLSpub on /var/ftp/pub type ext4 (rw)
/usr/local/share/gls/GLSINST/rhel6/isos/rhel-server-6.3-x86_64-dvd.iso on /var/ftp/pub/rhel6/dvd type iso9660 (ro,loop=/dev/loop0)
/dev/mapper/testvg-testlv on /tmp/testlv 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)
/etc/named on /var/named/chroot/etc/named type none (rw,bind)
/etc/rndc.key on /var/named/chroot/etc/rndc.key type none (rw,bind)
/usr/lib64/bind on /var/named/chroot/usr/lib64/bind type none (rw,bind)
/etc/named.root.key on /var/named/chroot/etc/named.root.key type none (rw,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
二、在主机上添加一块硬盘并为其创建主分区SDD
[root@instructor Desktop]# fdisk -cul /dev/sdd
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x00000000
[root@instructor Desktop]# fdisk -cu /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x20e92de4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Command (m for help): p
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x20e92de4
Device Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x20e92de4
Device Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@instructor Desktop]# fdisk -cul /dev/sdd1
Disk /dev/sdd1: 21.5 GB, 21473787904 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41940992 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 identifier: 0x00000000
三、为创建物理卷sdd1
[root@instructor Desktop]# pvcreate /dev/sdd1
Writing physical volume data to disk "/dev/sdd1"
Physical volume "/dev/sdd1" successfully created
[root@instructor Desktop]# pvdisplay /dev/sdd1
"/dev/sdd1" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdd1
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID bdeEPp-L9Az-QVMg-f1O6-gaK0-vRcw-RvL1cF
四、使用vgextend命令扩展卷组
[root@instructor Desktop]# vgextend testvg /dev/sdd1
Volume group "testvg" successfully extended
[root@instructor Desktop]# vgdisplay
--- Volume group ---
VG Name testvg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 4
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 59.98 GiB
PE Size 8.00 MiB
Total PE 7677
Alloc PE / Size 3840 / 30.00 GiB
Free PE / Size 3837 / 29.98 GiB
VG UUID ARmaCh-vFbx-dqxr-asWG-p11h-1Tzc-dv1OEi
五、使用lvextend命令扩展逻辑卷
[root@instructor Desktop]# lvextend -L +20G /dev/testvg/testlv
Extending logical volume testlv to 50.00 GiB
Logical volume testlv successfully resized
六、为逻辑卷重建文件系统
[root@instructor Desktop]# resize2fs /dev/testvg/testlv
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/testvg/testlv is mounted on /tmp/testlv; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/testvg/testlv to 13107200 (4k) blocks.
The filesystem on /dev/testvg/testlv is now 13107200 blocks long.
七、挂载逻辑卷并查看逻辑卷的挂载状态
[root@instructor Desktop]# mount /dev/testvg/testlv /tmp/testlv
[root@instructor Desktop]# mount
/dev/mapper/GLSvg-GLSroot 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/GLSvg-GLShome on /home type ext4 (rw)
/dev/mapper/GLSvg-GLStmp on /tmp type ext4 (rw)
/dev/sda5 on /usr/local/share/gls/GLSINST type ext4 (ro)
/dev/mapper/GLSvg-GLSvar on /var type ext4 (rw)
/dev/mapper/GLSvg-GLSpub on /var/ftp/pub type ext4 (rw)
/usr/local/share/gls/GLSINST/rhel6/isos/rhel-server-6.3-x86_64-dvd.iso on /var/ftp/pub/rhel6/dvd type iso9660 (ro,loop=/dev/loop0)
/dev/mapper/testvg-testlv on /tmp/testlv 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)
/etc/named on /var/named/chroot/etc/named type none (rw,bind)
/etc/rndc.key on /var/named/chroot/etc/rndc.key type none (rw,bind)
/usr/lib64/bind on /var/named/chroot/usr/lib64/bind type none (rw,bind)
/etc/named.root.key on /var/named/chroot/etc/named.root.key type none (rw,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/mapper/testvg-testlv on /tmp/testlv type ext4 (rw)
[root@instructor Desktop]#
[root@instructor Desktop]#umount /dev/testvg/testlv
[root@instructor Desktop]# mount
/dev/mapper/GLSvg-GLSroot 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/GLSvg-GLShome on /home type ext4 (rw)
/dev/mapper/GLSvg-GLStmp on /tmp type ext4 (rw)
/dev/sda5 on /usr/local/share/gls/GLSINST type ext4 (ro)
/dev/mapper/GLSvg-GLSvar on /var type ext4 (rw)
/dev/mapper/GLSvg-GLSpub on /var/ftp/pub type ext4 (rw)
/usr/local/share/gls/GLSINST/rhel6/isos/rhel-server-6.3-x86_64-dvd.iso on /var/ftp/pub/rhel6/dvd type iso9660 (ro,loop=/dev/loop0)
/dev/mapper/testvg-testlv on /tmp/testlv 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)
/etc/named on /var/named/chroot/etc/named type none (rw,bind)
/etc/rndc.key on /var/named/chroot/etc/rndc.key type none (rw,bind)
/usr/lib64/bind on /var/named/chroot/usr/lib64/bind type none (rw,bind)
/etc/named.root.key on /var/named/chroot/etc/named.root.key type none (rw,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
二、在主机上添加一块硬盘并为其创建主分区SDD
[root@instructor Desktop]# fdisk -cul /dev/sdd
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x00000000
[root@instructor Desktop]# fdisk -cu /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x20e92de4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Command (m for help): p
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x20e92de4
Device Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdd: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x20e92de4
Device Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@instructor Desktop]# fdisk -cul /dev/sdd1
Disk /dev/sdd1: 21.5 GB, 21473787904 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41940992 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 identifier: 0x00000000
三、为创建物理卷sdd1
[root@instructor Desktop]# pvcreate /dev/sdd1
Writing physical volume data to disk "/dev/sdd1"
Physical volume "/dev/sdd1" successfully created
[root@instructor Desktop]# pvdisplay /dev/sdd1
"/dev/sdd1" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdd1
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID bdeEPp-L9Az-QVMg-f1O6-gaK0-vRcw-RvL1cF
四、使用vgextend命令扩展卷组
[root@instructor Desktop]# vgextend testvg /dev/sdd1
Volume group "testvg" successfully extended
[root@instructor Desktop]# vgdisplay
--- Volume group ---
VG Name testvg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 4
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 59.98 GiB
PE Size 8.00 MiB
Total PE 7677
Alloc PE / Size 3840 / 30.00 GiB
Free PE / Size 3837 / 29.98 GiB
VG UUID ARmaCh-vFbx-dqxr-asWG-p11h-1Tzc-dv1OEi
五、使用lvextend命令扩展逻辑卷
[root@instructor Desktop]# lvextend -L +20G /dev/testvg/testlv
Extending logical volume testlv to 50.00 GiB
Logical volume testlv successfully resized
六、为逻辑卷重建文件系统
[root@instructor Desktop]# resize2fs /dev/testvg/testlv
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/testvg/testlv is mounted on /tmp/testlv; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/testvg/testlv to 13107200 (4k) blocks.
The filesystem on /dev/testvg/testlv is now 13107200 blocks long.
七、挂载逻辑卷并查看逻辑卷的挂载状态
[root@instructor Desktop]# mount /dev/testvg/testlv /tmp/testlv
[root@instructor Desktop]# mount
/dev/mapper/GLSvg-GLSroot 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/GLSvg-GLShome on /home type ext4 (rw)
/dev/mapper/GLSvg-GLStmp on /tmp type ext4 (rw)
/dev/sda5 on /usr/local/share/gls/GLSINST type ext4 (ro)
/dev/mapper/GLSvg-GLSvar on /var type ext4 (rw)
/dev/mapper/GLSvg-GLSpub on /var/ftp/pub type ext4 (rw)
/usr/local/share/gls/GLSINST/rhel6/isos/rhel-server-6.3-x86_64-dvd.iso on /var/ftp/pub/rhel6/dvd type iso9660 (ro,loop=/dev/loop0)
/dev/mapper/testvg-testlv on /tmp/testlv 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)
/etc/named on /var/named/chroot/etc/named type none (rw,bind)
/etc/rndc.key on /var/named/chroot/etc/rndc.key type none (rw,bind)
/usr/lib64/bind on /var/named/chroot/usr/lib64/bind type none (rw,bind)
/etc/named.root.key on /var/named/chroot/etc/named.root.key type none (rw,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/mapper/testvg-testlv on /tmp/testlv type ext4 (rw)
[root@instructor Desktop]#
相关文章推荐
- LVM管理体系(二)通过扩展LV扩展逻辑卷(操作步骤)
- LVM管理体系(四)缩小逻辑卷(操作步骤)
- LVM管理体系(四)删除逻辑卷(操作步骤)
- LVM管理体系(一)创建含有两个物理分区的逻辑卷(操作步骤)
- LVM逻辑卷管理一PV/VG/LV的创建
- LVM逻辑卷管理测试——逻辑卷扩展、收缩、快照及删除
- LVM逻辑卷管理一PV/VG/LV的创建
- LVM逻辑卷管理一PV/VG/LV的创建-Linux
- LVM--逻辑卷管理@扩展物理卷、卷组、逻辑卷完整篇
- linux服务器 磁盘和文件系统管理(二) LVM逻辑卷管理的基本操作
- linux服务器 磁盘和文件系统管理(二) LVM逻辑卷管理的基本操作
- 新玩法,CentOS7中LVM通过扩展逻辑卷扩展swap空间
- 新玩法,CentOS7中LVM通过扩展逻辑卷扩展swap空间
- Linux中逻辑卷(LVM)管理基本操作
- LVM逻辑卷管理,创建,扩展和缩减
- LVM逻辑卷管理一PV/VG/LV的创建-Linux
- Linux服务器通过LVM扩展其磁盘空间
- 为邮箱空间设置LVM逻辑卷管理的实验过程
- PHP mysql 扩展库 操作mysql数据库步骤
- 磁盘管理——逻辑卷lvm