2

After a standard installation of Linux Mint Debian Edition 4, this is how the hard drive is partitioned according to gnome-disk:

enter image description here

Ext4 is the standard file system for current Linux systems AFAIK. But what are the additional partitions, i.e. what is LUKS/LVM2 PV and why is there 2.1 MB unallocated space at the beginning? If I wanted to create a sparse, bootable clone of this system, do I have to recreate this exact partition structure or would it break anything if I just copied all files with cp to the new drive with a single Ext4 partition, plus the bootloader (i.e. the first 446 Bytes) using dd?

Finally, what is the meaning behind gnome-disk's (visually) vertical partitioning of 255 GB into 2 x 255 GB?

1 Answer 1

2

Gaps are normal when partitioning, but they’re usually in the megabytes, so not really important. They help align partitions (and as such, filesystems) to physical boundaries like blocks, erase blocks or whatever.

As for LVM (Logical Volume Manager), I’ll just quote Wikipedia:

LVM is used for the following purposes:

  • Creating single logical volumes of multiple physical volumes or entire hard disks (somewhat similar to RAID 0, but more similar to JBOD), allowing for dynamic volume resizing.
  • Managing large hard disk farms by allowing disks to be added and replaced without downtime or service disruption, in combination with hot swapping.
  • On small systems (like a desktop), instead of having to estimate at installation time how big a partition might need to be, LVM allows filesystems to be easily resized as needed.
  • Performing consistent backups by taking snapshots of the logical volumes.
  • Encrypting multiple physical partitions with one password.

LVM can be considered as a thin software layer on top of the hard disks and partitions, which creates an abstraction of continuity and ease-of-use for managing hard drive replacement, repartitioning and backup.

The bottom thing you see it’s what’s “really” on-disk: A LVM physical volume (PV). Physical Volumes are grouped together in Volume Groups. You create Logical Volumes inside Volume Groups. They need not align with disks or any other characteristics of underlying storage.

What you see on top is a Logical Volume. It is LUKS-encrypted and currently unlocked. It’s on top because it is backed by the PV below it.


Creating a sparse clone of the raw encrypted partition would not be possible. You can only created an unencrypted sparse clone.

Copying everything would be easiest. However, you cannot reuse the bootloader, which is not just the first 446 bytes but instead resides on the unencrypted ext4 partition. You’ll have to set up a boot configuration matching the clone. That’s especially true if you intend to change any of the details like LVM or no LVM, LUKS or not LUKS, single partition or separate /boot or whatever.


From the comments:

So the free space is just an "offset"?

Yes.

Is it reserved for anything or could I e.g. just "expand" the Ext4 partition into it?

It is probably not reserved. Yes, you could, but moving the start of a partition is really involved, so you should not.

And is there an explanation why LMDE decided to partition the disk this way and e.g. not integrate the Ext4 into the LUKS/LVM2 part?

The boot manager/loader, the kernel and the initramfs cannot be encrypted. That is why a separate /boot partition is required when doing system encryption.

Concerning cloning, do I understand this correctly: I cannot sparsify the encrypted part, because the file structure is obfuscated ("don't know where one file starts/ends"), but I can copy the files after unlocking the encryption (i.e. when doing cp, I will get a password prompt)?

You might want to read up disk encryption and LUKS. You can access the encrypted data directly on-disk. But you can of course also access the (transparently) decrypted data after unlocking, otherwise your system could not boot.

You can do whatever you want with your data, but you should not clone a mounted filesystem.

4
  • Thanks for this introduction! So the free space is just an "offset"? Is it reserved for anything or could I e.g. just "expand" the Ext4 partition into it? And is there an explanation why LMDE decided to partition the disk this way and e.g. not integrate the Ext4 into the LUKS/LVM2 part? Concerning cloning, do I understand this correctly: I cannot sparsify the encrypted part, because the file structure is obfuscated ("don't know where one file starts/ends"), but I can copy the files after unlocking the encryption (i.e. when doing cp, I will get a password prompt)?
    – david
    Commented Jul 15, 2020 at 21:28
  • I attempted to address your comment in the answer. However, I strongly suggest you read up on how disk encryption works. It is very different from file encryption.
    – Daniel B
    Commented Jul 16, 2020 at 11:16
  • Nice addendum. Thx!
    – david
    Commented Jul 16, 2020 at 13:01
  • UEFI Secure Boot allows booting signed executables. Commented May 11, 2021 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .