Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
>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.
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.
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.
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:
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.
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.
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.
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.
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.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.