I've got some questions about table partition after dd cloning a full disk. I have been cloning a full disk with a dual boot: Win + Ubuntu to an image. The disk contained the following partition:
WIN: MBR Partition + Primary + Recovery
and Ubuntu: Root partition '/' + Swap partition (I know this is not neccesary) + EFI Partition
and indirectly the Table partition which as far as I read, it is located in the very first 512 bytes (correct me if wrong) and a backup at the end of the disk.
I have shrank the main partitions of both OS to the minimum size and the compressed size result from ~60GiB to ~23GiB.
Well, I could make the reverse operation (de-compress from the image to the disk) and everything seems to be working fine after fixing table partition with gdisk.
However, I've got some questions about using DD:
- Does the table partition storage information about the unallocated space? I mean, If I only use 50GiB from a 250GiB disk (200 GiB unallocated), when I decompress the disk image on disk which are bigger than 50GiB and have a different size of the original one, will I be able to clone on those kind of disk?
- Soon I will try this installing both os, but on different disk. Can I just copy an specific partition?
- Build on 2nd point, can i restore an image which only contain a unique partition to a partition with different size and fix the information on table partition?
I hope you can clear me some doubts, best regards.
Partition table only describes allocated space, but when you use modern GPT partition table (instead of DOS partition table), you probably need to "repair" the secondary (backup) partition table at the end of the drive, this can be done with programs like fdisk
You can copy, but your OS will probably not boot when not setting up in the right way, I recommend to reinstall the OS
It's possible to copy a volume (filesystem) from any smaller partition to any bigger or equal sized partition. After copying, you can either decrease partition size or increase filesystem size. It's not recommended to copy a volume (filesystem) from a bigger partiton to a smaller partition without some manual adjustments. The recommended way for copying a volume from a bigger partition towards a smaller partition is to either decrease the volume size via filesystem mechanics or create a smaller new filesystem on the target smaller partition and manually copy all files from filesystem to filesystem.