LVM管理体系(二)通过扩展LV扩展逻辑卷(操作步骤)

一、查看现有逻辑卷状态和两个分区的状态
[root@instructor testvg]# fdisk -cul /dev/testvg/testlv


Disk /dev/testvg/testlv: 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 testvg]# fdisk -cul /dev/sdb1


Disk /dev/sdb1: 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


[root@instructor testvg]# fdisk -cul /dev/sdc1


Disk /dev/sdc1: 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

二、查看卷组的当前状态和自由空间
[root@instructor testvg]# vgdisplay /dev/testvg
  --- Volume group ---
  VG Name               testvg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               39.98 GiB
  PE Size               8.00 MiB
  Total PE              5118
  Alloc PE / Size       3840 / 30.00 GiB
  Free  PE / Size       1278 / 19.98 GiB
  VG UUID               ARmaCh-vFbx-dqxr-asWG-p11h-1Tzc-dv1OEi
   

三、使用lvextend命令扩展逻辑卷
[root@instructor testvg]# lvextend -L +10G /dev/testvg/testlv
  Extending logical volume testlv to 30.00 GiB
  Logical volume testlv successfully resized
[root@instructor testvg]# lvdisplay /dev/testvg/testlv
  --- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                YT3Ccy-eh5I-23fv-g1K6-YWXY-PJrs-rHcNXv
  LV Write Access        read/write
  LV Creation host, time instructor.example.com, 2014-04-15 23:15:37 +0800
  LV Status              available
  # open                 1
  LV Size                30.00 GiB
  Current LE             3840
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:106

  

四、重建逻辑卷的文件系统

[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 = 2
Performing an on-line resize of /dev/testvg/testlv to 7864320 (4k) blocks.
The filesystem on /dev/testvg/testlv is now 7864320 blocks long.

五、查看逻辑卷的挂载状态
[root@instructor testvg]# 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)
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 testvg]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值