LVM and all the other stuff like PVM etc

wiki.TerraBase.info
Revision as of 23:25, 6 February 2023 by Root (talk | contribs)
Jump to navigation Jump to search

The point here is to make use of a cloned disk / SSD. Linux will complain if one clones a disk / SSD because UUIDs are the same, so understandable. What to do?

Change the UUIDs? Arggg! Like so many things with Linux everyone has an opinion. I just love the people that say to, "...just wipe the 'offending' disk and start over." WTF?!?!? Really, that's your solution? Then what's the point of the clone? Why not just never do the clone, that way one doesn't have to do any wiping. Oh, yeah, there's a reason the clone was done in the first place moron.

Anyway, tons of commands for PVGs, LVMs, etc. See below;

PVG (Physical Volume Group)

Why not something better? Hmmm, what about this: vgimportclone (https://man7.org/linux/man-pages/man8/vgimportclone.8.html) and explained by: https://kerneltalks.com/howto/how-to-import-vg-using-different-vg-name/

Example: vgimportclone -n WhatEverNewNameForClonedDisk /dev/sdX (where sdX is the duplicate disk / SSD, UUIDs are generated automatically)

Oh, wait, not done yet. A small exception, because I have found the need to adjust / change disks months and years later from MBR / BIOS to GPT / UEFI and back the other way too. So that means, in preparation for that change, there needs to be a small section of the disk to store MBR information on a UEFI disk / SSD. In Linux, this seems to be BOOTBIOS (PS, it appears to be a really big secret, so there isn't much information about it, so thanks to a hint from https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks#What_is_the_BIOS_boot_partition.3F which quickly lead to https://en.wikipedia.org/wiki/BIOS_boot_partition for a nice explanation).

TUNE2FS? Nope, that's only for ExtX File Systems.

GDISK or FDISK using the "x" (expert command) to change the GUID, sort of, GDISK seems to be for GPT disks, not MBR disks, where as FDISK seems oriented towards MBR Disks, so...

To change the Disk Identifier;

  • fdisk /dev/sdX (where sdX s the disk / SSD to be modified)
    • Type the following (but not what's in the parenthesis);
      • x (for expert mode)
      • i (change the Disk Identifier)
      • Type the new ID starting with 0x (to identify it as a Hexadecimal Number, $ in the Commodore days) and 8 digits in length (which works out to 4 Bytes), for example: 0x12345678
      • r (return to 'non-expert' menu)
      • w (write the changes to the disk)
      • Thank you: https://forums.raspberrypi.com/viewtopic.php?t=191775


And of course if there are any EXT4 (EXT2, EXT3 formatted Partitions) that need a new UUID;

tune2fs -U random /dev/sdX

Instead of using individual mount commands for temporarily mounting a device, edit the freaking /etc/fstab file and run this command to mount or remount everything in the /etc/fstab file: mount -av

OK, how about renaming Logical Volumes and Logical Volume Groups?

...oh, and I cannot begin to describe how many different websites there are that provide information about various commands (lsblk, blkid), all very useful, but don't cover this one: SSM (Storage System Manager, for Fedora, CentOS, Rocky Linux, etc.) There's actual useful information here about Logical Volumes, DEVICEs and their mount points, etc. Try this: ssm list (WOW! Cool!)