Ako sa vygeneruje nové UUID? Mám disk, potrebujem ho dať do lvm a viem to spraviť bez UUID?
[root@localhost ~]# xfs_admin -U generate /dev/sdb1
Clearing log and setting UUID
writing all SBs
new UUID = e83aced9-c6a7-4e89-941a-768d2c6b449a
[root@localhost ~]#
- poďme tento disk dať do lvm + rovnaké UUID + vysvetlíme si prečo je dôležité používať UUID
ako to bolo v /etc/fstab
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Apr 19 16:28:51 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=08c4ec74-8080-4397-9b72-c5576a83da86 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
UUID=e83aced9-c6a7-4e89-941a-768d2c6b449a /data xfs defaults 0 0
1. Checknime adresár /data (pokiaľ by sme mali na servery dáta, je potrebné ich zálohovať a potom obnoviť)
[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
2. krok, vytvorili sme si lvm z partície /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. vytvorili sme xfs pre nové LV
[root@localhost ~]# mkfs.xfs /dev/mapper/data_vg-data_rozpravky
4. zmeníme xfs_admin pre UUID, nebudeme meniť /etc/fstab
[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
[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
--- preto je dôležité používať UUID, (samozrejme, robili sme to na čistom disku), ale je to rýchla cesta, pokiaľ máte disky, ktoré neboli v LVM a odrazu je ich potrebné do nich dať.
--- dá sa to vykonávať iba v XFS
Žiadne komentáre:
Zverejnenie komentára