linux下创建LV逻辑卷并挂载磁盘过程

买了个KT服务器,KT官方技术只给/home分了2G,也是醉了。教程参考http://jingyan.baidu.com/article/6079ad0e9d7d9e28fe86db11.html

创建PV:

扫面系统PV:pvscan

查看PV:pvdisplay

[root@DQ5620-C5-4-SAS ~]# pvscan
PV /dev/sda2 VG rootvg lvm2 [464.47 GiB / 425.47 GiB free]
Total: 1 [464.47 GiB] / in use: 1 [464.47 GiB] / in no VG: 0 [0 ]
[root@DQ5620-C5-4-SAS ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name rootvg
PV Size 464.48 GiB / not usable 16.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 14863
Free PE 13615
Allocated PE 1248
PV UUID pU8XYG-Au6O-vNrY-CMMa-2dzD-MuVP-ywykAh

创建 VG:

扫面系统VG:vgscan

查看VG:vgdisplay
[root@DQ5620-C5-4-SAS ~]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “rootvg” using metadata type lvm2

[root@DQ5620-C5-4-SAS ~]# vgdisplay
— Volume group —
VG Name rootvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size 464.47 GiB
PE Size 32.00 MiB
Total PE 14863
Alloc PE / Size 1248 / 39.00 GiB
Free PE / Size 13615 / 425.47 GiB
VG UUID HdhbhO-QoRy-3L06-d0QO-uabe-YnVy-panxcL

创建LV:

扫面系统LV:lvscan
[root@DQ5620-C5-4-SAS ~]# lvscan
ACTIVE ‘/dev/rootvg/homelv’ [2.00 GiB] inherit
ACTIVE ‘/dev/rootvg/rootlv’ [20.00 GiB] inherit
ACTIVE ‘/dev/rootvg/swaplv’ [4.00 GiB] inherit
ACTIVE ‘/dev/rootvg/tmplv’ [3.00 GiB] inherit
ACTIVE ‘/dev/rootvg/usrlv’ [5.00 GiB] inherit
ACTIVE ‘/dev/rootvg/varlv’ [5.00 GiB] inherit

创建LV:
[root@DQ5620-C5-4-SAS ~]# lvcreate -l 13615 -n datalv rootvg
Logical volume “datalv” created

[root@DQ5620-C5-4-SAS ~]# lvscan
ACTIVE ‘/dev/rootvg/homelv’ [2.00 GiB] inherit
ACTIVE ‘/dev/rootvg/rootlv’ [20.00 GiB] inherit
ACTIVE ‘/dev/rootvg/swaplv’ [4.00 GiB] inherit
ACTIVE ‘/dev/rootvg/tmplv’ [3.00 GiB] inherit
ACTIVE ‘/dev/rootvg/usrlv’ [5.00 GiB] inherit
ACTIVE ‘/dev/rootvg/varlv’ [5.00 GiB] inherit
ACTIVE ‘/dev/rootvg/datalv’ [425.47 GiB] inherit

格式化刚刚创建的LV

mkfs -t ext4 /dev/rootvg/datalv

[root@DQ5620-C5-4-SAS ~]# mkfs -t ext4 /dev/rootvg/datalv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
27885568 inodes, 111534080 blocks
5576704 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3404 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

创建目录并挂载

[root@DQ5620-C5-4-SAS ~]# mkdir /data
[root@DQ5620-C5-4-SAS ~]# mount /dev/rootvg/datalv /data
[root@DQ5620-C5-4-SAS ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv
20G 391M 19G 3% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 243M 33M 198M 15% /boot
/dev/mapper/rootvg-homelv
2.0G 67M 1.9G 4% /home
/dev/mapper/rootvg-tmplv
3.0G 69M 2.8G 3% /tmp
/dev/mapper/rootvg-usrlv
5.0G 2.0G 2.8G 42% /usr
/dev/mapper/rootvg-varlv
5.0G 227M 4.5G 5% /var
/dev/mapper/rootvg-datalv
419G 199M 398G 1% /data

《linux下创建LV逻辑卷并挂载磁盘过程》上有2条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注