本文共 3785 字,大约阅读时间需要 12 分钟。
1、格式化第二块硬盘,全部分为一个区,磁盘格式改为8e
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units=cylindersof 16065 *512=8225280bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45c5ab54
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 8e Linux LVM
# partprobe /dev/sdb
2、添加到lvm
[root@ecdata ~]#pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@ecdata ~]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.51 GiB
PE Size 4.00 MiB
Total PE 2434
Alloc PE / Size 2434 / 9.51 GiB
Free PE / Size 0 / 0
VG UUID EHdmVd-d3aD-GLFn-GfYn-tBgm-8JEk-dlUxgW
[root@ecdata ~]# vgextend VolGroup /dev/sdb1
Volume group "VolGroup" successfully extended
[root@ecdata ~]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 19.50 GiB
PE Size 4.00 MiB
Total PE 4992
Alloc PE / Size 2434 / 9.51 GiB
Free PE / Size 2558 / 9.99 GiB
VG UUID EHdmVd-d3aD-GLFn-GfYn-tBgm-8JEk-dlUxgW
[root@ecdata ~]# mount
/dev/mapper/VolGroup-lv_root 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)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
[root@ecdata ~]# lvextend -l +2558 /dev/VolGroup/lv_root
Extending logical volume lv_root to 17.53 GiB
Logical volume lv_root successfully resized
[root@ecdata ~]# umount /
umount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@ecdata ~]# e2fsck -f /dev/VolGroup/lv_root
e2fsck 1.41.12 (17-May-2010)
/dev/VolGroup/lv_root 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/VolGroup/lv_root: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup/lv_root: ***** FILE SYSTEM WAS MODIFIED *****
/dev/VolGroup/lv_root: ***** REBOOT LINUX *****
/dev/VolGroup/lv_root: 45265/494832 files (0.1% non-contiguous), 311135/1976320 blocks
[root@ecdata ~]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks=1,new_desc_blocks=2
Performing an on-line resize of /dev/VolGroup/lv_root to 4595712 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 4595712 blocks long.
[root@ecdata ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup/lv_root
VG Name VolGroup
LV UUID 1mralq-VrIX-cBmW-YtRh-9JZN-f9s1-S3e22k
LV Write Access read/write
LV Status available
# open 1
LV Size 17.53 GiB
Current LE 4488
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup/lv_swap
VG Name VolGroup
LV UUID ibqsE8-6ktx-PBE8-rqIC-VCcq-R2pS-Jlf0zr
LV Write Access read/write
LV Status available
# open 1
LV Size 1.97 GiB
Current LE 504
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@ecdata ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
18G 1.1G 16G 7% /
tmpfs 497M 0 497M 0% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
[root@ecdata ~]#
转载地址:http://uxdko.baihongyu.com/