lvm分區(qū)創(chuàng)建和擴(kuò)容
shell> fdisk /dev/xvdb #### 選擇磁盤
Command (m for help): m #### 幫助
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n #### 創(chuàng)建新的分區(qū)
Command action
e extended
p primary partition (1-4)
p #### 創(chuàng)建主分區(qū)
Partition number (1-4):1 #### 分區(qū)ID
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270):
Using default value 65270
Command (m for help):t #### 修改分區(qū)類型
Command (m for help):8e #### Linux lvm
Command (m for help):w #### 保存修改
shell> pvcreate /dev/xvdb1/ #### 創(chuàng)建新的pv卷
shell> pvs #### 查看pv卷
shell> vgcreate VolGroup01 /dev/xvdb1/ #### 創(chuàng)建新的vg卷
shell> vgs #### 查看vg卷
shell> lvcreate -L 50G -n lvmServer VolGroup01 #### 創(chuàng)建邏輯卷 -L 指定分區(qū)大小 -n 指定lvm名稱
shell> mkfs.ext4 /dev/VolGroup01/lvmServer #### 使用mkfs.ext4命令在邏輯卷lvmServer上創(chuàng)建ext4文件系統(tǒng)
shell> mount /dev/VolGroup01/lvmServer /server/ #### 掛在分區(qū)到本地目錄/server
shell> vi /etc/fstab #### 修改fstab 開機(jī)自動(dòng)掛載
#
# /etc/fstab
# Created by anaconda on Thu Aug 14 21:16:42 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 1 1
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
/dev/VolGroup01/lvmServer /server ext4 defaults 0 0
:wq
#### 保存重啟測(cè)試
注意:
* fstab一定要正確填寫路徑,一旦出錯(cuò),可能無法正常啟動(dòng).
* 可以在rc.local使用mount命令進(jìn)行掛載
擴(kuò)容
參考地址:http://www.rzrgm.cn/jackruicao/p/6258820.html
注意 xfs重新定義分區(qū)大小如果是xfs分區(qū)執(zhí)行
lvcreate -l 100%FREE -n lvmserver tid
這樣擴(kuò)展 就不需要再使用 xfs_growfs/resize2fs
lvextend -r -l +100%free /dev/mapper/vg1-vg1

浙公網(wǎng)安備 33010602011771號(hào)