在三個(gè)磁盤(pán)中創(chuàng)建 LVM 邏輯卷
在這個(gè)示例中是要?jiǎng)?chuàng)建一個(gè)名為 new_logical_volume 的邏輯卷,它由磁盤(pán) /dev/sda1、/dev/sdb1 和 /dev/sdc1組成。
1 創(chuàng)建物理卷
要在某個(gè)卷組中使用磁盤(pán),需要將其標(biāo)記為 LVM 物理卷。
警告
這個(gè)命令會(huì)破壞 /dev/sda1、/dev/sdb1 和/dev/sdc1中的所有數(shù)據(jù)。
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
Physical volume "/dev/sda1" successfully created
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
2 創(chuàng)建卷組
下面的命令可創(chuàng)建卷組 new_vol_group。
# vgcreate new_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1
Volume group "new_vol_group" successfully created
可以使用 vgs 命令顯示新卷組的屬性。
# vgs
VG #PV #LV #SN Attr VSize VFree
new_vol_group 3 0 0 wz--n- 51.45G 51.45G
3 創(chuàng)建邏輯卷
下面的命令可在卷組 new_vol_group 中創(chuàng)建邏輯卷 new_logical_volume。本示例創(chuàng)建的邏輯卷使用了卷組的 2GB 容量。
# lvcreate -L 2 G -n new_logical_volume new_vol_group
Logical volume "new_logical_volume" created
4 創(chuàng)建文件系統(tǒng)
mkfs -t ext4 /dev/vg_test/lv_test
創(chuàng)建目錄并掛載
創(chuàng)建目錄:mkdir /test
掛載:mount /dev/vg_test/lv_test /test
查看:df -h
還有最后一步,設(shè)置開(kāi)機(jī)掛載
將/dev/mapper/vg_test-lv_test /test ext4 defaults 1 2 寫(xiě)入 /etc/fstab
至此,大功告成!
參考鏈接:
http://jingyan.baidu.com/article/6079ad0e9d7d9e28fe86db11.html
https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html-single/Logical_Volume_Manager_Administration/index.html#vol_create_ex
給var目錄擴(kuò)容
http://www.cnblogs.com/sourceforge/p/mount-folder-to-new-disk-in-centos.html