LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-28-2009, 09:09 PM   #1
rbdavis
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Rep: Reputation: 3
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
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-29-2009, 03:36 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Just make a new MSDOS partition table with fdisk and make a filesystem with mkfs.
 
Old 05-29-2009, 10:32 AM   #3
rbdavis
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Original Poster
Rep: Reputation: 3
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.
 
Old 05-29-2009, 10:47 AM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
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.

Last edited by mostlyharmless; 05-29-2009 at 10:49 AM.
 
Old 05-29-2009, 02:27 PM   #5
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
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

Last edited by dv502; 05-29-2009 at 03:00 PM.
 
Old 05-30-2009, 08:40 PM   #6
rbdavis
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Original Poster
Rep: Reputation: 3
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
 
2 members found this post helpful.
Old 03-14-2010, 08:34 PM   #7
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
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.

Last edited by scottro11; 10-23-2010 at 02:10 PM.
 
Old 10-23-2010, 11:17 AM   #8
Vypster
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
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.
 
Old 12-31-2011, 12:33 PM   #9
rootus
LQ Newbie
 
Registered: Dec 2011
Location: Netherlands
Distribution: fedora
Posts: 15

Rep: Reputation: Disabled
Thumbs up Thanks

Yes old post blabla but still very helpfull!
Could not crack this problem until this post.
 
Old 02-14-2012, 05:03 PM   #10
DavidW522
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
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
 
Old 05-22-2012, 10:08 PM   #11
kitearoundtheworld
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 05-23-2012, 11:01 AM   #12
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
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.
 
Old 05-25-2012, 11:41 AM   #13
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,091

Rep: Reputation: 41
Quote:
Originally Posted by kitearoundtheworld View Post
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.
 
Old 02-16-2013, 03:14 PM   #14
PorkChops
LQ Newbie
 
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
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
 
Old 03-13-2013, 02:28 PM   #15
digitalage
LQ Newbie
 
Registered: Jul 2005
Posts: 1

Rep: Reputation: 1
Quote:
Originally Posted by PorkChops View Post
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.
 
1 members found this post helpful.
  


Reply

Tags
solution



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!!! Unable to convert GPT disk!!! kramer2718 Linux - Software 2 03-14-2009 09:44 PM
gpt label in parted, partitions look OK. GrUB not booting 64bit OS on 8th primary digital8doug Linux - Newbie 1 12-31-2008 02:20 PM
Huge piles of disk with LVM and/or RAID - GPT/GUID?? petcherd Slackware 2 12-18-2007 04:50 PM
How to change the label of a disk dtournas Red Hat 0 08-17-2004 08:02 AM
Disk label strangeness? MadCactus Linux - General 2 08-13-2003 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration