VG有空间,创建逻辑卷
Posted 发喜小爹
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VG有空间,创建逻辑卷相关的知识,希望对你有一定的参考价值。
1.查看VG空间
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 7 0 wz--n- 1.63t 1.37t
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LVroot
30G 2.2G 26G 8% /
tmpfs 253G 0 253G 0% /dev/shm
/dev/sda1 190M 40M 141M 22% /boot
/dev/mapper/VolGroup00-LVhome
30G 45M 28G 1% /home
/dev/mapper/VolGroup00-LVkdump
50G 52M 47G 1% /kdump
/dev/mapper/VolGroup00-LVtmp
20G 45M 19G 1% /tmp
/dev/mapper/VolGroup00-LVvar
20G 481M 19G 3% /var
2.查看LV
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LVhome VolGroup00 -wi-ao---- 30.00g
LVkdump VolGroup00 -wi-ao---- 50.00g
LVroot VolGroup00 -wi-ao---- 30.00g
LVswap VolGroup00 -wi-ao---- 20.00g
LVtmp VolGroup00 -wi-ao---- 20.00g
LVvar VolGroup00 -wi-ao---- 20.00g
3.创建lv(以100G为例)
[[email protected] ~]# lvcreate -L 100G --name LVdba VolGroup00
allocation/use_blkid_wiping=1 configuration setting is set while LVM is not compiled with blkid wiping support.
Falling back to native LVM signature detection.
Logical volume "LVdba" created.
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LVdba VolGroup00 -wi-a----- 100.00g
LVhome VolGroup00 -wi-ao---- 30.00g
LVkdump VolGroup00 -wi-ao---- 50.00g
LVroot VolGroup00 -wi-ao---- 30.00g
LVswap VolGroup00 -wi-ao---- 20.00g
LVtmp VolGroup00 -wi-ao---- 20.00g
LVvar VolGroup00 -wi-ao---- 20.00g
4.格式化
[[email protected] ~]# mkfs.ext4 /dev/mapper/VolGroup00-LVdba
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5.创建挂载目录
[[email protected] ~]# mkdir /dba
[[email protected] ~]# ll /
total 126
dr-xr-xr-x. 2 root root 4096 Dec 1 14:48 bin
dr-xr-xr-x. 5 root root 1024 Dec 1 13:18 boot
drwxr-xr-x. 2 root root 4096 Mar 23 2016 cgroup
drwxr-xr-x 4 mysql mysql 4096 Dec 6 10:47 dba
drwxr-xr-x 18 root root 3940 Dec 6 10:42 dev
drwxr-xr-x. 107 root root 12288 Dec 6 10:48 etc
drwxr-xr-x. 14 root root 4096 Dec 6 10:22 home
drwxr-xr-x. 4 root root 4096 Dec 1 13:18 kdump
dr-xr-xr-x. 13 root root 4096 Dec 1 14:48 lib
dr-xr-xr-x. 10 root root 12288 Dec 1 14:48 lib64
drwx------. 2 root root 16384 Dec 1 13:01 lost+found
drwxr-xr-x. 2 root root 4096 Sep 23 2011 media
drwxr-xr-x. 2 root root 4096 May 11 2016 misc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 mnt
drwxr-xr-x. 2 root root 4096 May 11 2016 net
drwxr-xr-x. 5 root root 4096 Dec 1 13:58 opt
dr-xr-xr-x 1652 root root 0 Dec 5 02:11 proc
dr-xr-x---. 5 root root 4096 Dec 5 19:34 root
dr-xr-xr-x. 2 root root 12288 Dec 1 14:48 sbin
drwxr-xr-x. 2 root root 4096 Dec 1 13:01 selinux
drwx------ 2 root sys 4096 Dec 6 10:48 sfroot
drwxr-xr-x. 2 root root 4096 Sep 23 2011 srv
drwxr-xr-x 13 root root 0 Dec 5 02:11 sys
drwxrwxrwt. 5 root root 4096 Dec 6 03:51 tmp
drwxr-xr-x. 13 root root 4096 Dec 1 13:02 usr
drwxr-xr-x. 23 root root 4096 Dec 1 13:50 var
6.编辑fstab表
[[email protected] ~]# vim /etc/fstab
/dev/mapper/VolGroup00-LVdba /dba ext4 defaults 1 2
7.生效fstab配置
[[email protected] ~]# mount -a
8.给挂载目录授权
[[email protected] ~]# chown -R mysql:mysql /dba
drwxr-xr-x 4 mysql mysql 4096 Dec 6 10:47 dba
8.检查是否完成
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LVroot
30G 2.2G 26G 8% /
tmpfs 253G 0 253G 0% /dev/shm
/dev/sda1 190M 40M 141M 22% /boot
/dev/mapper/VolGroup00-LVhome
30G 45M 28G 1% /home
/dev/mapper/VolGroup00-LVkdump
50G 52M 47G 1% /kdump
/dev/mapper/VolGroup00-LVtmp
20G 45M 19G 1% /tmp
/dev/mapper/VolGroup00-LVvar
20G 482M 19G 3% /var
/dev/mapper/VolGroup00-LVdba
99G 60M 94G 1% /dba
以上是关于VG有空间,创建逻辑卷的主要内容,如果未能解决你的问题,请参考以下文章