medwe
Posts: 4
Joined: Sun Mar 15, 2015 5:20 am

Raspian, USB disk, change from GPT to MBR

Tue Feb 09, 2016 9:53 pm

I've been trying to do some things to change me exteral USB 1tb drive from GPT to MBR. I removed the partitions and then tried gdisk recovery option to change the disk to MBR, Now I have a disk that still appears to be GPT and it now also says I have a misaligned forced MBR. What I want to do, with no concern about any data (obviously since I removed the existing partitions), is some how just completely convert it from GPT to MBR. I want to use this on the Pi I am using as a server. I currently have 3 disks (USB, self powered, plugged into a powered hub) attached and mounted, but this GPT disk doesn't seem to be able to mount (I use mount via UUID in fstab). So, can anyone tell me how to do this from the command line if possible? I currently just use Putty to work on the server.

THANKS!

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Raspian, USB disk, change from GPT to MBR

Wed Feb 10, 2016 8:28 am

use parted and mkfs

Code: Select all

parted -s /dev/sda mklabel mbr
parted -s /dev/sda mkpart primary 0% 100%
mkfs.ext4 -m 0 /dev/sda1

Edit; /gpt/mbr/
Last edited by elatllat on Thu Feb 11, 2016 10:09 am, edited 1 time in total.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

User avatar
rpdom
Posts: 17172
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspian, USB disk, change from GPT to MBR

Wed Feb 10, 2016 8:40 am

elatllat wrote:use parted and mkfs

Code: Select all

parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart primary 0% 100%
mkfs.ext4 -m 0 /dev/sda1
Wouldn't that create a GPT parition table on the drive, which is the opposite of what the OP requested?

Assuming there is no data that need to be retained I'd just trash the first few MB of the device, then create a new table with fdisk

Code: Select all

dd if=/dev/zero of=/dev/sda bs=1M count=1

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Raspian, USB disk, change from GPT to MBR

Wed Feb 10, 2016 8:42 am

Assuming that you have a Windows PC, the free version of MiniTool Partition Wizard can do this for you with just a few mouse clicks. It's a handy tool to have as it can handle Ext4 partitions too, so it provides a very easy point-and-click route to moving Pi OS /root partitions to hard drives if you ever fancy running your OS from a spinner...

http://www.partitionwizard.com/help/Con ... -disk.html
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

medwe
Posts: 4
Joined: Sun Mar 15, 2015 5:20 am

Re: Raspian, USB disk, change from GPT to MBR

Wed Feb 10, 2016 10:41 am

I tried the setting of the front-end of the disk to zeros - no errors where reported. I then went to fdisk via fdisk /dev/sdb. It claims the disk still has a GPT. I may try the Windows route - seems like it shouldn't be that hard to reinitialize a disk in Raspian.

Thanks for the replies!

wdt
Posts: 21
Joined: Wed Dec 16, 2015 6:04 am

Re: Raspian, USB disk, change from GPT to MBR

Wed Feb 10, 2016 12:49 pm

A GPT disk has a backup partition table at the end of the disk,,
17 sectors perhaps
So use dd and skip (after a bit of calculation)

sorry, not skip,, seek (skip is for input files)

Return to “Beginners”