lvm

 

fdisk -l
pvcreate /dev/sda
vgcreate datavg /dev/sda
lvcreate -L 5G -n lv_mysql datavg
lvcreate -L 5G -n lv_errlog datavg
lvcreate -L 10G -n lv_binlog datavg
lvcreate -L 30G -n lv_data datavg
#lvcreate -L 10G -n lv_relaylog datavg
lvcreate -L 10G -n lv_backup datavg

lvcreate -l 100%FREE -n lv_data datavg

mkfs.ext4 /dev/vg_data/lv_mysql
mkfs.ext4 /dev/mapper/vg_data-lv_mysql

ls /dev/datavg/ | sed 's/ /\n/g' |while read lv;do mkfs.ext4 /dev/datavg/$lv;done
for lv in `ls /dev/mapper/ | grep datavg` ;do echo "/dev/mapper/$lv /data ext4 defaults 0 1">> /etc/fstab; done


vim /etc/fstab
mount -a

mount /dev/vg_data/lv_mysql /mysql

 

 

vim /etc/fstab

/dev/LVMVolGroup/projects /mnt/projects ext4 defaults,nofail 0 0

 

lvextend -L +20G  /dev/vg_name/lv_name

resize2fs   /dev/vg_name/lv_name

 

umount /home/
e2fsck -f /dev/mapper/vg_cloud-LogVol00
resize2fs /dev/mapper/vg_cloud-LogVol00 10G
lvreduce -L 10G /dev/mapper/vg_cloud-LogVol00
e2fsck -f /dev/mapper/vg_cloud-LogVol00
mount /home/

 

https://www.digitalocean.com/community/tutorials/an-introduction-to-lvm-concepts-terminology-and-operations

https://www.cyberithub.com/extend-lvm-partition-using-lvextend-command

https://www.linuxtechi.com/extend-lvm-partitions/

posted @ 2021-01-06 14:57  sam_wang10  阅读(80)  评论(0编辑  收藏  举报