rename logical volume, lvm, lvrename

# check if the machine boots by default after reboot
reboot

# check situation
df -h

# output fstab
cat /etc/fstab

# umount /home
umount /home

# display name and volumes
lvdisplay

# renmae volume "home" to volume "mysql"
lvrename centos home mysql

# active and [yes]
vgchange -ay

# mount /home
mount /home
# error will be reported

# modify fstab to match the latest changes
vim /etc/fstab

# replace:
/dev/mapper/centos-home /home                   xfs     defaults        0 0
# with:
/dev/mapper/centos-mysql /home                   xfs     defaults        0 0
systemctl stop mariadb
systemctl status mariadb
ps aux|grep [m]ysqld
ps aux|grep [m]ysql
cd
ls
mkdir mysql
cd /var/lib/mysql/
ls -l
mv * ~/mysql
ls
pwd
cd ..
ls -lah /var/lib/mysql
vim /etc/fstab
mount /var/lib/mysql
chown -R mysql. /var/lib/mysql
mv ~/mysql/* .
ls -l
systemctl start mariadb

No comments: