針對操作系統:Red Hat Enterprise Linux Server release 5.8 (Tikanga)
注:自己的測試環境-----測試沒有問題
1.查看邏輯卷
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID E6hkkL-rkLw-OA2l-072h-QfMh-LDIN-feGjSM
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID azpGdn-iCfZ-DQX4-LNP8-Z0L4-aNKO-EqJ6A4
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
2.查看剩餘空間
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 3 0 wz--n- 47.78G 22.78G
3.新建一個邏輯分區: name:/dev/VolGroup00/LogVol02
[root@localhost ~]# lvcreate -L5120M -n /dev/VolGroup00/LogVol02 VolGroup00
Logical volume "LogVol02" created
4.再次查看邏輯分區
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID E6hkkL-rkLw-OA2l-072h-QfMh-LDIN-feGjSM
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID azpGdn-iCfZ-DQX4-LNP8-Z0L4-aNKO-EqJ6A4
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol02
VG Name VolGroup00
LV UUID O2U6Wa-1rxy-rOTr-Pw52-PM6g-vX0d-9mJs5h
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 160
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
5.新建需要掛載的目錄
[root@localhost ~]# mkdir /data1
6.需要格式化新建分區
[root@localhost ~]# mkfs -t ext3 -j /dev/VolGroup00/LogVol02
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
655360 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
7. mount 掛載新建分區到目錄
[root@localhost ~]# mount /dev/mapper/VolGroup00-LogVol02 /data1
8. 查看掛載結果
[root@localhost ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
9.7G 529M 8.7G 6% /
/dev/mapper/VolGroup00-LogVol01
9.7G 3.1G 6.2G 34% /usr
/dev/sda1 190M 13M 168M 8% /boot
tmpfs 249M 0 249M 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02
5.0G 139M 4.6G 3% /data1
註明:已經操作成功
9. 不用重啓就直接生效
[root@localhost ~]# partprobe
Warning: Unable to open /dev/hdc read-write (Read-only file system). /dev/hdc has been opened read-only.
10. 開機自動掛載
[root@localhost data1]# vi /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
/dev/VolGroup00/LogVol01 /usr ext3 defaults 1 2
/dev/VolGroup00/LogVol02 /data1 ext3 defaults 1 2 ###加入到這行,就可以完成配置
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
11. 寫入硬盤操作
sync ; sync