# cfdisk reports partition is unusable and I am unable to del?

## carlos123

Here is the output from cfdisk...

```

                                 cfdisk 2.11y

                              Disk Drive: /dev/hda

                        Size: 6400235520 bytes, 6400 MB

              Heads: 255   Sectors per Track: 63   Cylinders: 778

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)

 ------------------------------------------------------------------------------

    hda1        Boot        Primary   Linux ext3       [/boot]           106.93

    hda2                    Primary   Linux ext3       [/]              3142.06

                                      Unusable                           526.42

    hda3                    Primary   Linux ext3       [/home]          2097.45

    hda5                    Logical   Linux                              254.99

    hda6                    Logical   Linux ReiserFS                     271.44

     [  Help  ]  [ Print  ]  [  Quit  ]  [ Units  ]  [ Write  ]

                        Cannot delete an empty partition

                               Print help screen

```

I would like to be able to delete this partition and add it back into the pool of space from which I can make partitions but how do I do that?  

The disk in question is one of two I have on my system.  This one happens to have Redhat on it but I want to use the "Unusable" space and that in /dev/hda6 to fome one backup partition for my Gentoo system (on /dev/hdb).  /dev/hda5 is my Redhat swap partition.  

I don't quite remember what I was doing that make it unusable.  It has been perfectly usable since I first got my hard disk only becoming unusable recently.

Any suggestions?

Thanks. 

Carlos

----------

## JensZ

try fdisk

----------

## carlos123

Thanks JenZ.  I don't know why I didn't think of that!  

Using fdisk I was able to figure out that the "unusable" partition is most likely a place holder for the extended partition which holds /dev/hda5 and /dev/hda6.  If I add up the sizes of 5 and 6 I end up with the size of the the "unused" partition.  

I couldn't delete it for the same reason that one cannot delete a directory with files in it using "rm".  Namely because it had something in it.  Other partitions!

Carlos

----------

## Tiny_Guy

Well, I'm bringing this topic back.  I have empty space on my 120GB drive.  It's about 20GB in size.  I want to be able to create a partition there but cfdisk says it's unusable.

----------

## carlos123

No idea why cfdisk would say it's unusable Tiny_Guy.  Perhaps you could try deleting it first if that is possible through cfdisk.  It's been so long since I fooled around at the command line with utilities like cfdisk that I have forgotten most of what I once knew.  Sorry I couldn't help you more.

It sure is nice to have Gentoo running so well that I hardly ever have to mess with it anymore  :Smile: .  

Carlos

----------

## Tiny_Guy

When I try deleting it, it says that the partition is empty.  But when I try creating a new partition in that space, it says "This partition is unusable."  I think a possible solution is to use dd on that section of the disk.  How would I do that?

----------

## Baldzius

I don't think dd will help you , as i think that your problem is really identical as carlos123 had.

----------

## Tiny_Guy

Actually, I'm pretty sure that I made it a logical partition and not an extended partition, so I think dd may work.  It's too small to be an extended partitions because my 2 logical partitions are bigger than the unusable partition.

----------

## Baldzius

How you are going to use dd when you don't see that partition, as it is not a block device, it is free disc drive space called "unusable partiotion".

Check that drive with fdisk.

Maybe you should post an output.

----------

## Tiny_Guy

Here is the partition table output

```

Partition Table for /dev/hda

                                                                                

               First       Last

 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag

-- ------- ----------- ----------- ------ ----------- -------------------- ----

 1 Primary           0      192779     63      192780 Linux (83)           None

 2 Primary      192780     1204874      0     1012095 Linux (83)           None

 3 Primary     1204875   118399049      0   117194175 Extended (05)        None

 5 Logical     1204875   118399049     63   117194175 Linux (83)           None

 4 Primary   118399050   200314484      0    81915435 HPFS/NTFS (07)       Boot

  None      200314485   240107489      0    39793005 Unusable             None

```

BTW, the free space amounts to about 20GB

----------

## Tiny_Guy

According to the table, the unusable space is not my extended partition, and I don't think the extended partition would be at the end of the drive.  So what do you think about the issue at hand here?

----------

## Z?

Unless I'm horribly mistaken, any hard drive can only contain 4 primary partitions. An extended partition counts as one primary partition, while you can have something like 16 logical partitions within an extended partition.

In each of the cases above, there are at least 4 primary/extended partitions, thus rendering other areas of the drive as "unusable". There's nothing wrong with the drive itself, but if you want to reclaim the space, you'll need to resize or repartition the drive.

----------

## Tiny_Guy

so basically i would probably have to repartition the drive.  I don't see how resizing would help.

----------

## Baldzius

You really messed up your partition table.

Try to delete partition #4, and see what happens, also i don't see a swap partition.

----------

## Z?

 *Quote:*   

> so basically i would probably have to repartition the drive. I don't see how resizing would help.

 

Move all of the partitions so that the free space is adjacent to the extended partition. Then resize the extended partition to include the free space.

Now you can create yet another logical partition within the extended partition, using the currently unusable free space.

So, from your earlier message, this is your current partition layout:

```

Partition Table for /dev/hda 

                                                                                

               First       Last 

# Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag 

-- ------- ----------- ----------- ------ ----------- -------------------- ---- 

1 Primary           0      192779     63      192780 Linux (83)           None 

2 Primary      192780     1204874      0     1012095 Linux (83)           None 

3 Primary     1204875   118399049      0   117194175 Extended (05)        None 

5 Logical     1204875   118399049     63   117194175 Linux (83)           None 

4 Primary   118399050   200314484      0    81915435 HPFS/NTFS (07)       Boot 

  None      200314485   240107489      0    39793005 Unusable             None 
```

What you'd want to do is move partition 4 to the end of the disk, without resizing it. Then you should be able to resize partition 3 (the extended partition) to include the "unusable" space...

As long as the application you are using doesn't renumber the partitions, you'll be fine. Note that PartitionMagic WILL - I repeat, WILL - renumber the partitions. When this happens, you'll need to boot off of a rescue CD (like the LiveCD...), and modify /etc/fstab and /boot/grub/grub.conf appropriately. After that, you should be good to go.

----------

## Tiny_Guy

I fixed that issue, but now windows won't start because because I need to change boot.ini and I can't change it because I only have read-only access to the partition.

----------

## Z?

Do you have a bootable WindowsXP disk kicking around? If so, then it'll allow you to boot into a "rescue console", where you can fix the boot.ini file. I'm not going to guarantee that it'll work, but it might.

----------

## Tiny_Guy

Would I be able to find one if I don't have one lying around?

----------

## Tiny_Guy

another thing, when I try to boot into windows with the fixed boot.ini, it says that hal.dll is missing or corrupt.

----------

## Z?

You've pretty much tapped out my knowledge. I've run into the same situation you're describing, but I never did figure out a way to fix it.  :Crying or Very sad: 

----------

## Tiny_Guy

Well, I ran the rescue console with the installation disc, and then I expanded the file from the cd to overwrite the one on the hard drive.  It still didn't work.  The only solution I can think of is to reinstall Windows.  IF someone knows of another way, please tell.

----------

## Tiny_Guy

Now the windows xp install cd doesn't seem to want to boot up the setup anymore.  Very odd.  Anyway, if someone can help me or direct me to someone who can, please let me know.

----------

## klatre

I had a similar problem with hal.dll missing, didn't find the solution any where on this board.

I fixed it by pointing boot.ini to the correct partition where xp is installed.

That is if you have

/dev/hda1 /boot

/dev/hda2 /Windows Xp

Your boot.ini should look like this:

```
[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition([color=red]2[/color])\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition([color=red]2[/color])\WINDOWS="Microsoft Windows XP Professional" /fastdetect
```

I use lilo to boot my xp bootloader and my partition table is kinda wierd:

/dev/hda2 /boot

/dev/hda3 /Windows Xp

But still i needed my boot.ini to point to partition(2).

Here is the link that helped me:

http://www.kellys-korner-xp.com/xp_haldll_missing.htm

Hope it helps.

----------

