lvm中怎麼增大根分割槽的步驟:

tonykorn97發表於2008-09-25

1,檢視磁碟分割槽,其中/dev/sda5是沒有用的磁碟空間
[root@server1 /]# fdisk -l

Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1318 10482412+ 8e Linux LVM
/dev/sda3 1319 1383 522112+ 82 Linux swap / Solaris
/dev/sda4 1384 1958 4618687+ 5 Extended
/dev/sda5 1384 1958 4618656 83 Linux
[root@server1 /]#

[@more@]

2,檢視vg,剩餘空間為0
[root@server1 /]# vgdisplay
--- Volume group ---
VG Name VolGroup00
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.97 GB
PE Size 32.00 MB
Total PE 319
Alloc PE / Size 319 / 9.97 GB
Free PE / Size 0 / 0
VG UUID o8XLQS-jxb8-ZKid-sYxF-y97T-1M1S-AKBdz3


3,擴充套件vg
[root@server1 /]# vgextend VolGroup00 /dev/sda5
Volume group "VolGroup00" successfully extended
[root@server1 /]# vgdisplay
--- Volume group ---
VG Name VolGroup00
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 14.34 GB
PE Size 32.00 MB
Total PE 459
Alloc PE / Size 319 / 9.97 GB
Free PE / Size 140 / 4.38 GB
VG UUID o8XLQS-jxb8-ZKid-sYxF-y97T-1M1S-AKBdz3


4,檢視載入的分割槽資訊:
[root@server1 /]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[root@server1 /]#

5,擴充套件根分割槽的lv
[root@server1 /]# lvextend -L +4.3G /dev/VolGroup00/LogVol00
Rounding up size to full physical extent 4.31 GB
Extending logical volume LogVol00 to 8.31 GB
Logical volume LogVol00 successfully resized
[root@server1 /]# umount /
umount: /: device is busy
umount: /: device is busy


6,執行檔案系統檢查:
[root@server1 /]# e2fsck -f /dev/VolGroup00/LogVol00
e2fsck 1.39 (29-May-2006)
/dev/VolGroup00/LogVol00 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? yes

/dev/VolGroup00/LogVol00: 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/VolGroup00/LogVol00: ***** FILE SYSTEM WAS MODIFIED *****
/dev/VolGroup00/LogVol00: ***** REBOOT LINUX *****
/dev/VolGroup00/LogVol00: 114168/1048576 files (0.6% non-contiguous), 695530/1048576 blocks


7,執行resize2fs
[root@server1 /]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2179072 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2179072 blocks long.


8,重新檢視lv資訊和mount的資訊
[root@server1 /]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID 8Ows1C-xr8e-kkS7-j2Kj-ZLyn-0gV9-eimuHk
LV Write Access read/write
LV Status available
# open 1
LV Size 8.31 GB
Current LE 266
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID jcgE93-1O2G-DXu6-grv1-UNSV-z9L1-03oYHS
LV Write Access read/write
LV Status available
# open 1
LV Size 5.97 GB
Current LE 191
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

[root@server1 /]# df -h
檔案系統 容量 已用 可用 已用% 掛載點
/dev/mapper/VolGroup00-LogVol00
8.1G 2.6G 5.2G 34% /
/dev/mapper/VolGroup00-LogVol01
5.8G 2.6G 2.9G 48% /home
/dev/sda1 99M 12M 83M 13% /boot
tmpfs 125M 0 125M 0% /dev/shm
[root@server1 /]#

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1011025/,如需轉載,請註明出處,否則將追究法律責任。

相關文章