> 文章列表 > Linux系统创建逻辑卷

Linux系统创建逻辑卷

Linux系统创建逻辑卷

一、磁盘分区

 fdisk /dev/vdb
Welcome to fdisk (util-linux 2 .32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (3,4, default 3):
First sector (5357568-20971519, default 5357568):
Last sector, +sectors or +size{K,M,G,T,P} (5357568-20971519, default 20971519): +1G
Created a new partition 3 of type 'Linux' and of size 1 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.

二、创建物理

 pvcreate /dev/vdb3

三、创建卷组

vgcreate -s 20M npgroup /dev/vdb3

四、创建逻辑

lvcreate -n np -l 45 npgroup

五、格式化

mkfs.ext3 /dev/npgroup/np

六、创建挂载点

mkdir /mnt/np

七、永久挂载

vim /etc/fstab

添加如下内容:

/dev/npgroup/np /mnt/np ext3 defaults 0 0