# gpart does not see disk



## balanga (Feb 12, 2018)

I was trying to convert a disk from mbr to gpt and then the disk stopped responding.  After a reboot gpart does not see it at all.
`camcontrol devlist`:-


> <TOSHIBA MK5061GSYB MH000C>  at scbus1 target 0 lun 0 (pass1, ada1)



How do I make it visible to GPART?


----------



## SirDice (Feb 12, 2018)

If gpart(8) doesn't show anything it typically means there's no partition table on the disk.


----------



## balanga (Feb 12, 2018)

SirDice said:


> If gpart(8) doesn't show anything it typically means there's no partition table on the disk.



Doesn't gpart(8) create a partition table when running `gpart create -s gpt ada0`?

Linux `Gparted` provided an option for creating a partition table. Can't FreeBSD do this?


----------



## trev (Feb 13, 2018)

The man page for gpart(8) provides a blow by blow example for creating a GPT scheme partition on FreeBSD.

Note: Requires the GEOM_PART_GPT kernel option.


----------



## phoenix (Feb 13, 2018)

balanga said:


> Doesn't gpart(8) create a partition table when running `gpart create -s gpt ada0`?



The OP's disk is ada*1*, but that is the correct command to create a GPT partition table on a disk.


----------



## SirDice (Feb 13, 2018)

balanga said:


> I was trying to convert a disk from mbr to gpt and then the disk stopped responding. After a reboot gpart does not see it at all.


I'm guessing the partition table got corrupted so much it's not even recognized anymore. At least I can imagine this happening when you're writing a new partition table and something happens during this write action. The disk stopped responding and you rebooted so this write action may never have finished. The partition table may be gone, the actual data on the disk is probably still there. I hope you made a backup of the partition table _before_ you started changing it?


----------



## balanga (Feb 13, 2018)

The previous contents of the disk were obsolete. so it didn't really matter.

Just out of interest what is the recommended way of backing up the partition table and where would you keep it?


----------



## SirDice (Feb 13, 2018)

For example:
`gpart backup ada0 > partitiontable-ada0.txt`
Make sure you keep that partitiontable-ada0.txt file somewhere safe. Preferably not on the disk you're about to screw up 
You can restore it with `cat partitiontable-ada0.txt | gpart restore ada0`.


----------

