Unable to create a partition

Asked by Mannex

Trying to format and use a small 40G spot on my disk, but seem unable to partition and/or format it. It is marked as free space in the extended part of the drive. Disk Utility complained saying:

helper exited with exit code 1: In part_add_partition:
device_file=/dev/sda,
start=204470221824
size=40192967680, type =0x83
MSDOS_MAGIC found
...

My fstab looks like this:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=ef41d98d-58df-4a7c-bb53-2c6a54224806 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=8048c0f6-e2dd-483c-8b0f-971fcacbeb63 none swap sw 0 0
# swap was on /dev/sda7 during installation
UUID=78e8e587-a1c3-43b3-9d21-3f9fbaf992ec none swap sw 0 0

Any ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Mannex
Solved:
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Can you type
    sudo parted -l
and post result.

Sorry, but I am used to Gparted.
Can you install, via Synaptic, gparted and after System->Administration->Gparted, try again to format.

Revision history for this message
Tom (tom6) said :
#2

Hi :)

Yes, on a command-line
https://help.ubuntu.com/community/UsingTheTerminal#Starting%20a%20Terminal
please give us the output of

sudo fdisk -l

where "-l" is a lower-case "-L" and sudo asks for your normal user password, not your superuser one and gives no stars as you type.
Good luck and regards from
Tom :)

Revision history for this message
Mannex (russ-mannex) said :
#3

Response for delance:

Interesting result. I get the following:

mannex@Leviathan:~$ sudo parted -l
Error: Invalid partition table on /dev/sda -- wrong signature 0.
Ignore/Cancel? i
Model: ATA WDC WD2500BEKT-6 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 1049kB 204GB 204GB primary ext4 boot
 2 204GB 250GB 45.6GB extended
 5 245GB 250GB 5396MB logical linux-swap(v1)

The "wrong signature" error is a little disconcerting. Might that be the issue?

Revision history for this message
Mannex (russ-mannex) said :
#4

Tom, here's the result of your suggestion:

mannex@Leviathan:~$ sudo fdisk -l
omitting empty partition (6)

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00064ef9

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 24859 199676800+ 83 Linux
/dev/sda2 24859 30402 44520449 5 Extended
/dev/sda5 29746 30402 5269504 82 Linux swap / Solaris

Hope that helps.

Revision history for this message
Tom (tom6) said :
#5

Hi :)

So, as you said there is a space just before sda5 that should be possible to use. My first thought about this question was that you were trying to create a 5th primary partition and the msdos format doesn't allow that.

It looks as though yu are trying to set-up a dual-boot with another version of linux? Is the existing one KDE based or does it use the Gnome Desktop Environment instead? If it is Kubuntu or another KDE based one then please use "QtPartEd" instead of GPartEd. Both programs are almost identical.

Now i am hoping that simply re-writing the partition table will sort the signatures problems out. The GPartEd program is much the best tool for the job. On the LiveCd of Ubuntu (and most other distros) it is already there but on an existing hard-drive install try this command

sudo apt-get install gparted

Then on the top taskbar click on

System - Administration - "Partition Editor" (or Gparted in 10.04)

Hopefully this should show a pretty graphic of your hard-drive. The Extended Partition is shown as a pale blue outline, swap is red and linux partitions are blue. The 40Gb empty space should be grey. Right-click on that and make it a "Logical Partition" with file-system = ext3.

Ext4 is good for data (/home) but we still occasionally find trouble trying to keep a / installed on an ext4 with Ubuntu. So lets try ext3 as it seems a little more robust at the moment.

Please let us know if GPartEd wont open and let us know what happens anyway!
Good luck and regards from
Tom :)

Revision history for this message
Mannex (russ-mannex) said :
#6

Thank you, Tom, for the suggestion. I will try it. In the meantime, I have a few comments.

First, how did this drive get an MSDOS format? I got it brand new, and installed Ubuntu on the drive. Is it possible to have ext4 and MSDOS format at the same time? The word "MSDOS" bothers me, makes me a little nervous.

I do not want a dual boot. I would much rather extend the existing partition, but I don't think I can do that and save everything on the existing partition, right?

I am using Gnome, so gparted is an option, and I have it on the boot disk. I'll install it right now and let you know how it goes.

Thanks!

Revision history for this message
Mannex (russ-mannex) said :
#7

Hmm. This doesn't sound good. When I run gparted, it says that the entire drive is "unallocated."

I'm guessing this isn't going to be easy. =8>

Revision history for this message
Tom (tom6) said :
#8

Hi :)

Don't worry about the partition table type being msdos. In this case the only thing really wrong with it is the attempt to restrict the number of partitions the drive can handle. Since the "Extended Partition" type was forced on them even that is not a problem now.

In theory it would be easier to do what you suggested. Just delete the swap partition at the end of the drive, then delete the extended partition and then resize sda1 to fill the entire drive. It is usually better to have a separate /home partition to keep your data&settings nicely safe during re-installs of the / tho so rather than resizing sda1 i would recommend making an sda3 for /home and then resize sda1 right down to 5-10Gb. It only needs to be 5Gb when then /home is split off but i tend to go for 8Gb in case i stuff up an install sometime in the future. Either way you will need an sda2 linux-swap immediately after sda1 (or before it but after is easier to set-up). If you make the /home before the swap then sda2 would be your /home & sda3 would be the swap, which is fine too. Anyway, that is all in theory.

GPartEd (or QtPartEd) being unable to read the Partition Table is a bit of a worry. We might be pushed into using data recovery techniques to solve this one but lets try something a bit lighter first. On a linux command-line type in

sudo parted

This will convert the terminal window into a "parted" command-line instead of it being a linux command-line. This is a very powerful tool and is what GPartEd & QtPartEd both use to do the real work. While they try to make things pretty and safer for users parted doesn't bother to ask to confirm things and doesn't wait for you to click on the "Apply" button. It just goes straight ahead and deletes stuff if you tell it to. It is much more powerful so be careful! Luckily it also has a handy help file so on the PartEd command-line just type in

help

To see it's help-file and to check that things make sense before you enter commands. Ok, lets just have a look at what PartEd thinks your hard-drive looks like

print all

The PartEd command-line also makes use of the keyboard up-arrow for cycling back through previous commands used. I think it remembers commands used in previous sessions too. So it can be handy for edited and re-entering something similar to something you have used before.

If parted cannot see sda1 then it might be worth trying to use the "rescue" command in there. From the fdisk command we saw the following line about sda1
/dev/sda1 * 1 24859 199676800+ 83 Linux
which should give us the information we need for parted's rescue command :) Annoyingly parted counts from 1 whereas fdisk counts from 1 so we have to do -1 from the fdisk information, grrrr. First tho, we have to make sure parted is using the same units of measurement. Again from the fdisk command we can see this line
Units = cylinders of 16065 * 512 = 8225280 bytes
so, try these commands

unit cyl

Ok, so now we are ready to try rescuing sda1 by using this command?

rescue 0 24858

Hopefully that should set us back on-track with sda1 showing up in a newly opened GPartEd but first you will probably have to get safely off the parted command-line by typing in

quit

I hope something here helps!
Good luck and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#9

Hi again :)

Err, just in case you do consider using a separate /home partition this guide should help
https://help.ubuntu.com/community/Partitioning/Home/Moving
using "cp" or just drag&drop is likely to mess up the permissions and stuff so it is better to use the rsync command. Rsync was designed to do proper back-ups so it is ideal for this type of thing :)

I thought first step would be to set-up the partitions and make sure that sda1 & the partition table were fixed before progressing anywhere more adventurous.

Good luck and regards from
Tom :)

Revision history for this message
Mannex (russ-mannex) said :
#10

Thanks again, Tom. Here's the parted session:

mannex@Leviathan:~$ sudo parted
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all
Error: Invalid partition table on /dev/sda -- wrong signature 0.
parted: invalid token: all
Ignore/Cancel? i
Model: ATA WDC WD2500BEKT-6 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 1049kB 204GB 204GB primary ext4 boot
 2 204GB 250GB 45.6GB extended
 5 245GB 250GB 5396MB logical linux-swap(v1)

(parted) unit cyl
(parted) rescue 0 24858
Error: Invalid partition table on /dev/sda -- wrong signature 0.
parted: invalid token: 0
Ignore/Cancel? i
Start? y
Error: Invalid number.

Um... any ideas?

Revision history for this message
delance (olivier-delance) said :
#11

I got an answer in a forum, which looks easy.
Do a
   sudo fdisk /dev/sda
then type
   w
to write partition table, without any modification of it.
The signature should be fixed.

Revision history for this message
Mannex (russ-mannex) said :
#12

That fixed the partition table. Thanks. Now, checking to see if I can
format that little chunk of disk...
--
Mannex

On Sat, 2010-06-05 at 21:15 +0000, delance wrote:

> Your question #113539 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/113539
>
> delance proposed the following answer:
> I got an answer in a forum, which looks easy.
> Do a
> sudo fdisk /dev/sda
> then type
> w
> to write partition table, without any modification of it.
> The signature should be fixed.
>

Revision history for this message
Mannex (russ-mannex) said :
#13

OK, that worked. Once I followed delance's suggestion, I was able to just use Disk Utility (under Admin menu) to format it. Now, I can use it. Thanks!

Revision history for this message
Tom (tom6) said :
#14

Hi :)

Sorry my way didn't work. Good work from Delance, again, and an easier answer too! :))

Glad you fixed it,
Welcome to linux-land, especially the Ubuntu corner of it
Congrats and regards from
Tom :)

Revision history for this message
G (c3148603) said :
#15

""""I got an answer in a forum, which looks easy.
Do a
   sudo fdisk /dev/sda
then type
   w
to write partition table, without any modification of it.
The signature should be fixed.""""

Worked for me
acer aspire v3-571g
ubuntu 12.04