LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   can't get rid of GPT disk label (https://www.linuxquestions.org/questions/linux-general-1/cant-get-rid-of-gpt-disk-label-729209/)

rbdavis 05-28-2009 09:09 PM

can't get rid of GPT disk label
 
I have a machine with a 3Ware 9650 RAID card controlling one small disk functioning as a standalone disk holding my Linux installation (/, /boot, etc.)
and several other disks which are aggregated into a RAID-5 volume. The system vendor configured the latter with a GPT disk label. The total RAID size is under 2 Tb so GPT is really not required, and I would prefer maintaining it with fdisk just because that's what I'm used to. fdisk complains that the disk device (/dev/sdb) has a GPT label, however.

The vendor told me to wipe the beginning of the disk with dd and that would clear the GPT. It did not. I found documentation stating that a duplicate label was also stored at the end of the disk, so I also tried wiping that to no avail. These steps did, however, clear the partition table of entries and I can use fdisk to add new partitions, then use mke2fs to build a filesystem which looks OK. However, even after all this, whenever I use fdisk it still complains about the old GPT hanging around although that does not appear to otherwise impede fdisk's ability to manipulate the disk label. How the heck can I get rid of this GPT stuff, or does it not matter at all that it's still hanging around? The one thing I do not want obviously is to have my users fill this filesystem with data and then have it get ultimately corrupted because fdisk and GPT are fighting with each other.

I also tried parted's own 'mklabel msdos' command, hoping that would get rid of the GPT and just leave me with an old-style label, but that did not clear the GPT either.

Any advice on how to clean this mess up, or believable assurance that it does not actually matter?

Thanks!

Roger Davis
Univ. of Hawaii

veerain 05-29-2009 03:36 AM

Just make a new MSDOS partition table with fdisk and make a filesystem with mkfs.

rbdavis 05-29-2009 10:32 AM

can't get rid of GPT disk label
 
>Just make a new MSDOS partition table with fdisk and make a filesystem with mkfs.

Thanks, contusion, but that does not work. (I assume you mean fdisk's 'o' command.) Well, it works in the sense that the new label is built and the disk otherwise functions as expected, but I continue to get the error message about a pre-existing GPT whenever I run fdisk.

mostlyharmless 05-29-2009 10:47 AM

Certainly it'd be overkill and take a while on a 2 TB disk, but you could use dd on the whole disk since it sounds like you missed part of the GPT label with dd. gparted can deal with GPT disks, so perhaps you could use it to restore it, then delete the GPT label and replace it with the "traditional" PC partition table.

dv502 05-29-2009 02:27 PM

First suggestion.

Since you have a raid card, most likely it will have its own bios. Have you checked it's bios to see anything related to hard drive setups? Maybe there's an option to overwrite the disklabel.

Second suggestion.
Have you tried deleting the partitions and creating new ones or changing the ID of the partition?

A few years ago, I had a unused freebsd partition. I formatted it as an ext3 partition. I soon realized I was having issues with the partition. I type fdisk -l to check the layout. To my surprised, the partition ID said freebsd. That was strange. I formatted the partition as an ext3.

So, I had a freebsd label with an ext3 file system. After a while of goggling, I saw a post that said to change the partition ID using fdisk. It said, run fdisk, then type the letter p to display entries. Then type t for partition type, select the partition you want to change, type L for listings and then type the ID code. Type p again to see if the changes were made. If satisfied, type w to write the new table.

This procedure has worked and my partition ID said linux.

Anyway, I hope this will help. Just a suggestion to try since it worked for me in the past.

- Cheers

rbdavis 05-30-2009 08:40 PM

Thanks to all for their suggestions, the problem is solved. The vendor who sold me the system and created the unwanted GPT was able to ultimately figure it out.

There really are GPTs at both the beginning and end of the disk, it is insufficient to clear only the first one. The following pair of dd commands ultimately worked. I had actually already tried something similar but the dd command I used for the end of the disk was somewhat different and failed to work for reasons unknown. These commands worked:

# dd if=/dev/zero of=/dev/sdb bs=512 count=2
# dd if=/dev/zero of=/dev/sdb bs=512 seek=2929629465

(/dev/sdb has 182361 cylinders of 16065 512b sectors each for a total of 2929629465 sectors.)

Thanks again to everyone!

Roger Davis

scottro11 03-14-2010 08:34 PM

Though this is a very old thread, I just wanted to give my own thanks. I had tried deleting the partition with parted without success--not sure where my error was. This was an 8GB USB stick, that I had used for OS X things. Your solution worked perfectly.

Figured it merited thanks, despite the fact that this a 9 month old thread.

Vypster 10-23-2010 11:17 AM

Again, I appreciate that this is a very old thread, but solved my problem perfectly when no others could. Ironically, also with an 8GB USB stick.

Thank you.

rootus 12-31-2011 12:33 PM

Thanks
 
Yes old post blabla but still very helpfull!
Could not crack this problem until this post.

DavidW522 02-14-2012 05:03 PM

Yes very helpful, I was stuck unable to install my astaro security gateway even after trying bdans boot and nuke and gparted on the drive with out luck but the dd commands worked like a champ.


Thanks

kitearoundtheworld 05-22-2012 10:08 PM

Can't belive how many people keep posting the wrong answer in this thread. There's no need to do the dd. Follow these steps EXACTLY and you WILL remove the partition:

Removing GPT information from a drive
=====================================

Linux/Unix:
1. Type "parted /dev/<devicename>", usually "parted /dev/sda".
2. Once inside parted type "mktable":
-> Table type: msdos
-> Destroy data: yes
-> quit
3. GPT should now be removed.

scottro11 05-23-2012 11:01 AM

heh, I see my response is about 2 years old by now--but yes, in the interim I've learned of your (kitearoundtheworld's) solution and yup, that works too.

trey85stang 05-25-2012 11:41 AM

Quote:

Originally Posted by kitearoundtheworld (Post 4685291)
Can't belive how many people keep posting the wrong answer in this thread. There's no need to do the dd. Follow these steps EXACTLY and you WILL remove the partition:

Removing GPT information from a drive
=====================================

Linux/Unix:
1. Type "parted /dev/<devicename>", usually "parted /dev/sda".
2. Once inside parted type "mktable":
-> Table type: msdos
-> Destroy data: yes
-> quit
3. GPT should now be removed.

People are more likely to have dd installed then parted.... for the purpose of portability dd is a better solution.

edit: Also this thread helped me a out a few years ago as well.

PorkChops 02-16-2013 03:14 PM

Just highlighting something that may not be obvious (at least to me) -- the solution shown by original poster indicated:
Quote:

(/dev/sdb has 182361 cylinders of 16065 512b sectors each for a total of 2929629465 sectors.)
but did not state how that value was arrived at. For me, I used sfdisk to display the kernel's view of the total number of cylinders, heads, and tracks and then multiplied them together to arrive at the "seek" number -- for example:
Code:

# sfdisk -g /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util sfdisk doesn't support GPT. Use GNU Parted.

/dev/sdb: 17849 cylinders, 255 heads, 63 sectors/track

# echo 17849*255*63|bc
286744185

# dd if=/dev/zero of=/dev/sdb bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00851528 s, 60.1 kB/s

# dd if=/dev/zero of=/dev/sdb bs=512 seek=286744185
dd: writing `/dev/sdb': No space left on device
5304+0 records in
5303+0 records out
2715136 bytes (2.7 MB) copied, 0.186222 s, 14.6 MB/s

# sfdisk -g /dev/sdb
/dev/sdb: 17849 cylinders, 255 heads, 63 sectors/track


digitalage 03-13-2013 02:28 PM

Quote:

Originally Posted by PorkChops (Post 4893215)
Just highlighting something that may not be obvious (at least to me) -- the solution shown by original poster indicated:

but did not state how that value was arrived at. For me, I used sfdisk to display the kernel's view of the total number of cylinders, heads, and tracks and then multiplied them together to arrive at the "seek" number -- for example:
Code:

# sfdisk -g /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util sfdisk doesn't support GPT. Use GNU Parted.

/dev/sdb: 17849 cylinders, 255 heads, 63 sectors/track

# echo 17849*255*63|bc
286744185

# dd if=/dev/zero of=/dev/sdb bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00851528 s, 60.1 kB/s

# dd if=/dev/zero of=/dev/sdb bs=512 seek=286744185
dd: writing `/dev/sdb': No space left on device
5304+0 records in
5303+0 records out
2715136 bytes (2.7 MB) copied, 0.186222 s, 14.6 MB/s

# sfdisk -g /dev/sdb
/dev/sdb: 17849 cylinders, 255 heads, 63 sectors/track


I got a SSD and could not format (using regular tools) or install Windows on it. I tried linux tools aswell, but it didn't work anything, untill I found the above post - thank you PorkChops! This is the only way I could get rid of the GPT info.


All times are GMT -5. The time now is 10:18 AM.