Topic: Add GPT to non-partitioned disk?

Added an 8TB disk to my Linux Mint system using the Disk manager to format as NTFS. Only later did I realize that the thing formatted the disk without first adding a partition table. Windows, of course, won't recognize the resulting "bare" partition without a GPT.

Is there a way to add a GPT to the existing non-paritioned disk? Resize the "bare" partition to make room for the GPT, then use "recover" to try to find the partition?


- Paul


Re: Add GPT to non-partitioned disk?

I guess it is a data disk, not a system or boot disk.
It is possible to have an entire hard drive formatted with a filesystem, without partition table. This is not the usual case for fixed drives. It was common on floppy disks and removable devices like usb sticks.
GParted works on partitioned media.

Perhaps the simple way is to backup the disk content, partition the drive, make a new filesystem and restore the files in it. Anyway, backup is never a bad idea.

Otherwise, I think it becomes too experimental, unless anyone has already did it and can confirm that it works. Of course, a backup is mandatory before such operations.
I'm not sure if you can resize the filesystem with ntfsresize. It is contained in the GParted Live cd/usb as well as other Linux live media (resize2fs" works on ext2/3/4 filesystems). Perhaps you can use the mswidows resizing tool, if you have a working windows installation (I guess so, because you use the ntfs filesystem). Furthermore, you need to have windows checking/fixing the resized filesystem by booting twice, as it is the rule for any resized ntfs filesystem.
It would be better to shrink it as much as you can, to make the moving operation faster. After resizing, you have to move the filesystem to its definitive starting position (leaving the 1st MiB empty for the GUID partition table).
I'm not sure if you need an EFI partition for a non-system hard drive (it is needed for system drives).

Then you have to create the GPT. The legacy fdisk supports MBR but not GPT. So, you need an updated fdisk version that is able to manipulate GPT, or gdisk (part of the "GPT fdisk" project). cfdisk can handle GPT too.
You have to just create the partition entry in the partition table, without making any change in the partition space itself. This was possible in MBR drives by fdisk, within the limit of 2TiB. I can't tell if it is works on the GPT drives by newer tools.

Trying to "recover" the partition with "testdisk" is perhaps another way to explore.

As I did never try myself to add GPT on a non-partitioned hard drive which already contains data, I can't give a valid advice. Of course you can try it yourself if you are fluent with the command line tools, and report the result here. Of course, you have to be sure that you have a good backup copy of any important data before proceeding.

*** It is highly recommended to backup any important files before doing resize/move operations. ***


Re: Add GPT to non-partitioned disk?

Thanks much for the advice. Yes, it is a data disk. Being new to Linux Mint, I didn't realize that the UI Disk utility would happily format a disk without first creating a partition table. As you say, that is not the normal way to do things, but the UI seems to have no guardrails for us newbies. Sigh...

You are absolutely right that the proper way to solve the problem is just copy the data to another properly-formatted disk, which I've done. The problem here is that the disk is one of those horrible Seagate SMR drives and a heavy write load seems to have corrupted the NTFS file system. (An entire directory of files was lost when the system deadlocked on a write operation during a copy and I had to reboot.)

Usually I'd just boot into Windows and run chkdsk as you suggest. But, because of the lack of GPT, Windows won't recognize the disk. So, the thought was to repair the drive well enough to run chkdsk.

At this point, it may be that the easiest path is to recreate the lost files, erase the disk and start over.

I'll file a ticket on that Linux Mint Disk utility to add some warning about formatting a disk without a partition table so that this doesn't happen to newbies.

Thanks again.