lvm

[root@test ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created.
[root@test ~]# vgcreate centos_home /dev/sdc
Volume group "centos_home" successfully created
[root@test ~]# lvcreate -L 999G -n my_logical_volume centos_home
Logical volume "my_logical_volume" created.
[root@test ~]# mkfs.ext4 /dev/centos_home/my_logical_volume
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done 
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65470464 inodes, 261881856 blocks
13094092 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2409627648
7992 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, 214990848

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

[root@test ~]# mkdir /dbdata
[root@test ~]# mount /dev/centos_home/my_logical_volume /dbdata
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 30G 1.8G 28G 6% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.1M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 497M 81M 417M 17% /boot
/dev/sdb1 32G 49M 30G 1% /mnt/resource
tmpfs 799M 0 799M 0% /run/user/1000
tmpfs 799M 0 799M 0% /run/user/0
/dev/mapper/centos_home-my_logical_volume 984G 77M 934G 1% /dbdata

 

 

再次扩容1t:

 

  361  pvcreate /dev/vdc
  362  vgdisplay
  363  df -h
  364  vgextend centos_home /dev/vdc
  365  lvdisplay
  366  lvextend -L +999G /dev/mapper/centos_home-my_logical_volume /dev/vdc
  367  df -h
  368  resize2fs /dev/mapper/centos_home-my_logical_volume

 

posted @ 2021-04-09 16:16  小菜鸟111  阅读(74)  评论(0编辑  收藏  举报