I am repairing a computer for someone that has two distinct disks. Populated and partitioned as follows:
- is filled with multiple Operating systems on multiple partitions
- is an internal data drive with a single partition (i.e. undivided)
Now unfortunately the data drive is the one that got the partition table.
- The way I understand it is they started by installing windows, then arch linux but since they left the data drive plugged in, they ended up with the wrong drive getting the partition table.
- They didn't notice for many months, proceeding to install arch linux side by side windows, and only noticed recently when they unplugged their data drive that the partition table disapeared.
- The problem I am faced with before attempting to copy and then remove the partition table, is that I don't have the space backup their data ahead of time just in case
My Question:
So I am curious if in general procedures to copy the partition table between disks and then make both disks useable by reseting/randomizing the GUID is safe and independent of the allready existing data?
sgdisk -R=/dev/sdb /dev/sda sgdisk -G /dev/sdb
I got the two sgdisk
commands from this answer: https://unix.stackexchange.com/a/60393/173317
Setup Specifics
The results of lsblk -fa
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1
└─sda2 ntfs COMPUTER 16 digit alpha numeric code
sdb
├─sdb1 ntfs System Reserved 16 digit alpha numeric code
├─sdb2 ntfs 16 digit alpha numeric code
├─sdb3 ntfs 16 digit alpha numeric code
├─sdb4
├─sdb5 swap SWAP 8 digits-4 digits-4 digits-4 digits-12 digits [SWAP]
├─sdb6 ext4 BOOT 8 digits-4 digits-4 digits-4 digits-12 digits /boot
├─sdb7 ext4 ROOT 8 digits-4 digits-4 digits-4 digits-12 digits /
└─sdb8 ext4 HOME 8 digits-4 digits-4 digits-4 digits-12 digits /home
sr0
The results of parted -l
Model: ATA ST3500320AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 1018kB 1000kB bios_grub
2 1049kB 500GB 500GB ntfs Basic data partition msftdata
Model: ATA ST2000DX001-1CM1 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 106MB 105MB primary ntfs boot
2 106MB 107GB 107GB primary ntfs
3 107GB 107GB 472MB primary ntfs diag
4 107GB 2000GB 1893GB extended lba
5 107GB 116GB 8590MB logical linux-swap(v1)
6 116GB 117GB 1074MB logical ext4 boot
7 117GB 139GB 21.7GB logical ext4
8 139GB 192GB 53.7GB logical ext4
The results of fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8 digits-4 digits-4 digits-4 digits-12 digits
Device Start End Sectors Size Type
/dev/sda1 34 1987 1954 977K BIOS boot
/dev/sda2 2048 976771071 976769024 465.8G Microsoft basic data
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 10 alpha numeric (hex) digits
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT
/dev/sdb2 206848 208795647 208588800 99.5G 7 HPFS/NTFS/exFAT
/dev/sdb3 208795648 209717247 921600 450M 27 Hidden NTFS WinRE
/dev/sdb4 209717248 3907026943 3697309696 1.7T f W95 Ext'd (LBA)
/dev/sdb5 209719296 226496511 16777216 8G 82 Linux swap / Solaris
/dev/sdb6 * 226498560 228595711 2097152 1G 83 Linux
/dev/sdb7 228597760 271032319 42434560 20.2G 83 Linux
/dev/sdb8 271034368 375891967 104857600 50G 83 Linux
Running sgdisk -p
from home and the root of the data drive both return nothing.
sgdisk
before, would running either of these commands really put me at risk of altering the UUID? I was under the impression that GUID and UUID were completely independent... I thought UUID was hardware dependent/specific. – EngBIRD Aug 22 '16 at 01:50sgdisk -b
,sgdisk -p
(just for a more readable version), andlsblk -fa
(if you want to get really crazy you can dolsblk -O
) and put them all on a USB disk you should be ready for anything partition wise. – Brian Redbeard Aug 22 '16 at 01:52sgdisk -p
I don't get anything, and the when I check the manual it explicitly says "displays" not saves. Is this possibly a bad sign? – EngBIRD Aug 22 '16 at 02:08lsblk -fa
, and the computer only boots when this data drive is plugged in so there must be a partition table. Didn't occur to me before, but perhaps runningsgdisk -p
from the OS itself, didn't see the data drive, and only saw the disk where the root partition was. Still things to investigate tomorrow. – EngBIRD Aug 22 '16 at 02:22fdisk -l
on the disk to print it. – Brian Redbeard Aug 22 '16 at 02:36gdisk
will detect differences and warn the user. Upon start, sgdisk attempts to identify the partition type in use on the disk. From the man page: "If it finds valid GPT data, sgdisk will use it. If sgdisk finds a valid MBR or BSD disklabel but no GPT data, it will attempt to convert the MBR or disklabel into GPT form." http://linux.die.net/man/8/sgdisk – Brian Redbeard Aug 27 '16 at 21:22