您的位置:首页 > 其它

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

2014-04-16 00:34 471 查看
一、查看现有逻辑卷状态和两个分区的状态

[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]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: