On 07/14/18 02:04, Pascal Hambourg wrote:
Le 14/07/2018 à 02:49, David Christensen a écrit :
# file -s /dev/sda1
/dev/sda1: BTRFS Filesystem label "po_boot", sectorsize 4096, nodesize
16384, leafsize 16384, UUID=6ff0dd1d-8d46-454b-bb35-a09afc47145a,
65490944/999292928 bytes used, 1 devices
2018-07-13 17:39:51 root@po ~
# file -s /dev/sda2
/dev/sda2: data
2018-07-13 17:39:59 root@po ~
# file -s /dev/sda3
/dev/sda3: LUKS encrypted file, ver 1 [aes, xts-plain64, sha256] UUID:
0152d2e2-4cfb-42c4-a121-6fb832962e47
The output for /dev/sda2 is not very informative (e.g. clues that it
has dm-crypt, random key, and swap).
As expected. /dev/sda2 contains raw encrypted data which appear as
random data. It is the purpose of encryption that one cannot see the
real contents.
Okay.
Beware that unlike a UUID or LABEL, a PARTUUID or PARTLABEL is stored
in the partition table, not in the partition data.
Also note that a DOS partition table entry does not contain a UUID
nor LABEL, and the PARTUUID is artificially built by combining the
32-bit "disk identifier" field in the MBR and the partition number.
So if the partition number or the disk identifier changes, the
PARTUUID changes.
In short :
- if you move the disk contents (including the partition table) to
another disk, the PARTUUID is preserved ;
- if you move the partition contents to another partition, the
PARTUUID is not preserved.
Thanks for the warning. My typical use-case is to move the entire
system drive image between various 16+ GB devices, so PARTUUID should
work.
I forgot to mention another case, although you are not concerned :
- logical partitions numbers and synthetic PARTUUIDs may change when
creating or deleting another logical partition on the same disk.
Fortunately, I only need 3 partitions on my system drives. I have
always used primary partitions.
Yet
another reason to not use logical partitions and prefer GPT if you need
more than 4 partitions.
GPT is nice; I use it when I want a 2+ TB partition (such as my backup/
archive/ image drives). But I have several older computers, so I prefer
solutions that work with BIOS/MBR.
David