ITPub博客

首页 > IT基础架构 > 网络安全 > lvm中怎么增大根分区的步骤:

lvm中怎么增大根分区的步骤:

原创 网络安全 作者:tonykorn97 时间:2008-09-25 15:44:45 0 删除 编辑

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博客 ” ,链接:https://blog.itpub.net/312079/viewspace-1011025/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-05

  • 博文量
    1854
  • 访问量
    2088311