štvrtok 22. apríla 2021

UUID, xfs_admin and LVM

 How works with UUID? We have new disks and it's mounted only as partition. But Linux has LVM and it's great. Let's start with migration to lvm without changes in /etc/fstab

Only small mark: There are disks without data. (If we have data, we will backup and restore after our operation)


1. check directory /data 


[root@localhost ~]# df -h


Filesystem               Size  Used Avail Use% Mounted on


devtmpfs                 485M     0  485M   0% /dev


tmpfs                    496M     0  496M   0% /dev/shm


tmpfs                    496M  6.7M  489M   2% /run


tmpfs                    496M     0  496M   0% /sys/fs/cgroup


/dev/mapper/centos-root   17G  1.5G   16G   9% /


/dev/sda1               1014M  167M  848M  17% /boot


tmpfs                    100M     0  100M   0% /run/user/0


/dev/sdb1               1020M   33M  988M   4% /data





1



2. create lvm from /dev/sdb1


[root@localhost ~]# umount /data/


[root@localhost ~]# pvcreate /dev/sdb1


WARNING: xfs signature detected on /dev/sdb1 at offset 0. Wipe it? [y/n]: y


  Wiping xfs signature on /dev/sdb1.


  Physical volume "/dev/sdb1" successfully created.


[root@localhost ~]# vgcreate data_vg /dev/sdb1


  Volume group "data_vg" successfully created


[root@localhost ~]# lvcreate -n data_rozpravky -l 100%FREE data_vg


  Logical volume "data_rozpravky" created.


  

3. create filesystem xfs to new logical volume 


[root@localhost ~]# mkfs.xfs /dev/mapper/data_vg-data_rozpravky


 



4.change UUID via command xfs_admin (this UUID is old UUID on /dev/sdb1)


[root@localhost ~]# xfs_admin -U e83aced9-c6a7-4e89-941a-768d2c6b449a /dev/mapper/data_vg-data_rozpravky


Clearing log and setting UUID


writing all SBs


new UUID = e83aced9-c6a7-4e89-941a-768d2c6b449a


and, mount ;-)  (If you have data, now it's time to restore) 


- please do not use rm -rf, click click :-)



[root@localhost ~]# mount -a


[root@localhost ~]# df -hT


Filesystem                         Type      Size  Used Avail Use% Mounted on


devtmpfs                           devtmpfs  485M     0  485M   0% /dev


tmpfs                              tmpfs     496M     0  496M   0% /dev/shm


tmpfs                              tmpfs     496M  6.7M  489M   2% /run


tmpfs                              tmpfs     496M     0  496M   0% /sys/fs/cgroup


/dev/mapper/centos-root            xfs        17G  1.5G   16G   9% /


/dev/sda1                          xfs      1014M  167M  848M  17% /boot


tmpfs                              tmpfs     100M     0  100M   0% /run/user/0


/dev/mapper/data_vg-data_rozpravky xfs      1017M   33M  985M   4% /data




Žiadne komentáre:

Zverejnenie komentára