根文件系统快用完了,给你一块新硬盘,怎样实现根文件系统扩容?这是面试中经常会出现的一个问题。接下来,我们就在虚拟机里面做一下这个试验。 1、试验环境
物理机:Windows XP 虚拟机:VMware 7
虚拟系统:RHEL 4
2、在VMware里面新增一块SCSI虚拟硬盘
确认虚拟系统RHEL4处于关机状态,用VMware打开Red Hat Enterprise Linux 4.vmx,点击Edit virtual machine setings,点击Add按钮,选中Hard Disk,点击Next按钮,选中Create a new virtual disk,点击Next按钮,选中SCSI,点击Next按钮,设置Maximum disk size为8,点击Next按钮,点击Finish按钮,点击OK按钮,启动虚拟系统RHEL4。
3、根文件系统扩容 用一句话来总结:创建物理卷 >>> 卷组扩容 >>> 逻辑卷扩容 >>> 文件系统扩
(1)创建物理卷
[root@Shell_HAT]# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created (2)查看创建好的物理卷
[root@Shell_HAT]# pvdisplay /dev/sdd
--- NEW Physical volume ---
PV Name /dev/sdd
VG Name
PV Size 8.00 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 5ne1Nx-bsCO-9Vxh-6Pmc-rBnf-dsZo-WjQDYS (3)卷组扩容 [root@Shell_HAT]# vgextend VolGroup00 /dev/sdd
Volume group "VolGroup00" successfully extended (4)查看扩容之后的卷组信息 [root@Shell_HAT]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 18 VG Access read/write
VG Status resizable MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 4
Act PV 4
VG Size 31.78 GB PE Size 32.00 MB Total PE 1017
Alloc PE / Size 760 / 23.75 GB
Free PE / Size 257 / 8.03 GB
VG UUID djJXj5-3rkx-PEpi-2OJn-ZofS-VaF6-KUo9UR (5)逻辑卷扩容 [root@Shell_HAT]# lvextend -L +8G /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 27.81 GB
Logical volume LogVol00 successfully resized (6)查看扩容之后的逻辑卷
[root@Shell_HAT]# lvdisplay /dev/VolGroup00/LogVol00
--- Logical volume --- LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID kOehzE-SEAQ-tm3L-jIkG-gbZv-YWC5-apQWWf
LV Write Access read/write
LV Status available
# open 1
LV Size 27.81 GB
Current LE 890
Segments 5
Allocation inherit
Read ahead sectors 0
Block device 253:0 (7)文件系统在线扩容
[root@Shell_HAT]# ext2online /dev/VolGroup00/LogVol00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
(8)大功告成 [root@Shell_HAT]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
28G 17G 9.4G 65% / /dev/sda1 99M 9.0M 85M 10% /boot
none 506M 0 506M 0% /dev/shm
阅读(3465) | 评论(0) | 转发(0) |