I had a working Ubuntu LUKS installation on a 120Gb SATA SSD and I have just cloned it using dd
to a larger, faster 240Gb NVME SSD (I haven't expanded the partitions yet).
lsblk
:
nvme0n1 259:0 0 223.6G 0 disk
├─nvme0n1p1 259:1 0 487M 0 part /boot
├─nvme0n1p2 259:2 0 1K 0 part
└─nvme0n1p5 259:3 0 118.8G 0 part
└─sdb5_crypt 253:0 0 118.8G 0 crypt
├─ubuntu--vg-root 253:1 0 110.8G 0 lvm /
└─ubuntu--vg-swap_1 253:2 0 8G 0 lvm
└─cryptswap1 253:3 0 8G 0 crypt [SWAP]
I have also followed these instructions to make it bootable/decryptable remotely via ssh
.
Previously I used to make backups by taking a dd
image of the SSD, however now I would rather not do full images as it would be wasteful to save images with so much free space on them.
So I would like to somehow back it up compressed, if possible using something similar to this excellent solution using squashfs streaming compression. Of course, it is pointless compressing the full encrypted drive as it will hardly save any disk space.
I would like to be able to create the backup on-the-fly, without needing to have temporary space the size of the whole image.
Also, I would like to be able to loop-mount the backup to recover single files if necessary, without having to extract the entire archive.
To clarify, I do not need the backup files to be encrypted as they will be stored on an encrypted filesystem, but if I need to recover, I do need to end up with a bootable LUKS drive at the end.
How can I achieve all this?
Are there any solutions to backup LUKS drives using compression?