Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Migrating from MBR to GPT?



from Thomas Klausner:

> I've recently noticed that I have a 4TB disk in use of which I'm only
> using 2TB.

> # disklabel wd0 | tail -5
> 5 partitions:
> #        size    offset     fstype [fsize bsize cpg/sgs]
 a: 4294965247      2048       RAID                     # (Cyl.      2*- 4294967295*)
>  c: 4294965247      2048     unused      0     0        # (Cyl.      2*- 4294967295*)
>  d: 4294967295         0     unused      0     0        # (Cyl.      0 - 4294967295*)

> Probably because it was set up with an MBR instead of a GPT:

> # fdisk wd0
> Disk: /dev/rwd0d
> NetBSD disklabel disk geometry:
> cylinders: 7752021, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
> total sectors: 4294967295

> BIOS disk geometry:
> cylinders: 1023, heads: 240, sectors/track: 63 (15120 sectors/cylinder)
> total sectors: 3519069872

> Partitions aligned to 15120 sector boundaries, offset 63

> Partition table:
> 0: NetBSD (sysid 169)
>     start 2048, size 4294965247 (2097151 MB, Cyls 0/32/33-284058/164/3), Active
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
> Bootselector disabled.
> First active partition: 0


> I know that MBRs and GPTs conflict. Is there a way to migrate this
> disk to a GPT so that I can make use of the remaining data (without
> copying all the data off to a separate disk)?

> Or is migrating to a GPT optional, and I can use the remaining space
> in some other way?

gpt migrate may do it, no guarantees from me on not losing data, but what would be overwritten at the beginning of partition a looks to be well within the offset of 2048 sectors.

You might want to back up just to be safe.

You would have to run 
gpt biosboot -c /usr/mdec/gptmbr.bin -i 1 -L desired_label wd0

using your choice of label for rather than desired_label verbatim.

Then you would need to rerun installboot.

You could also create a NetBSD swap partition, but you know better than me if that is needed, or how big it should be.

Only time I remember running "gpt migrate" was on a Western Digital My Book Essential 3 TB USB 3.0 hard drive, connected to a USB 2.0 port, one NTFS partition.  All data remained intact; I used System Rescue CD to read and copy the software on the hard disk to a USB stick formatted for ext2fs; couldn't read NTFS from NetBSD.

Tom



Home | Main Index | Thread Index | Old Index