Cloning Rocky Linux 9 and Useful Commands to Use Afterwards

wiki.TerraBase.info
Jump to navigation Jump to search

Drive Cloning Commands

DD and DDRESCUE

Changing PG, VG, and LV Names and 'UUIDs'

Naming Info: pvs, vgs, and lvs (those are three separate commands)

Detailed Information: pvdisplay, vgdisplay, lvdisplay (again, thee separate commands)

Scanning: pvscan, vgscan, lvscan (and again, thee separate commands)

Rename Commands: vgrename and lvrename

UUID for FAT: mlabel -i /dev/sdb1 ::abcd-wxyz

UUID for EXT4: tune2fs -U random /dev/sdb2 (...and it will demand this bed one first: e2fsck -f /dev/sdb2)

UUID for PV: pvchange --uuid /dev/sdb3 (...but first: vgchange -an WhatEverOriginalVGName, to view: pvdisplay /dev/sdb3, and to turn it back on: vgchange -ay WhatEverNewVGName)

UUID for VG:

UUID for LV: lvchange --uuid /dev/sdb3 (...but first: lgchange -an WhatEverOriginalVGName/WhatEverOriginalLVName, to view: lvdisplay /dev/sdb3, and to turn it back on: lvchange -ay WhatEverNewVGName/WhatEverNewLVName)

UUID for PV: pvchange --uuid /dev/sdb3 (...but first: vgchange -an WhatEverOriginalVGName, to view: pvdisplay /dev/sdb3, and to turn it back on: vgchange -ay WhatEverNewName)

Stuff to 'Worry About' (and correct) after changing a VG or LV Name

Mount the ROOT, BOOT, and EFI Directories so editing of these files can be done:

  • /etc/default/grub
  • /etc/fstab
  • /boot/loader/entries/WhatEverEntryFile.conf
  • /boot/grub2/grub.cfg (UUIDs and VG / LV Names)
  • /boot/efi/EFI/WhatEverDirectory/grub.cfg (UUID of GRUB (EXT4) Partition)

Other CleanUP and Changes

"Computer Name": hostname, hostnamectl status, hostnamectl set-hostname WhatEverNewName (/etc/hostname)

/etc/host

EFI Related Stuff

General Info: efibootmgr

Verbose Info: efibootmgr -v

Change Boot Order: sudo efibootmgr -o 0002,0001,0000

Delete and Entry: efibootmgr -b 0003 -B

Add an Entry: efibootmgr -c -d /dev/nvme0n1p1 -p 1 -L "ApacheTrafficH" -l '\EFI\ApacheTrafficH\grubx64.efi'


Changing "Computer Names"

View Host Name: hostnamectl status

Set / Change Host Name: hostnamectl set-hostname NEWNAME

Another place to modify a Host Name: /etc/hosts

...and if something goes wrong and one arrives at a GRUB Command Prompt;

Remove all other drives

ls

ls (hd0,gpt2)/

set root=(hd0,gpt2) (this is the BOOT Partition, not the ROOT Partition, as it is from the perspective of GRUB)

linux /vmlinuz root=/dev/VG.NGFF.P3/LV.ROOT ro

initrd /initramfs.img

boot

sgdisk --randomize-guids=1 /dev/sda (this will change all Partition UUIDs, which doesn't seem to affect LVs)

grub2-mkconfig -o /boot/grub2/grub.cfg