You are not logged in.

#1 2009-04-03 04:33:45

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

[SOLVED] Help deleting non-existing "partition" in fdisk?

Some background:  I used to have four partitions on this drive: sdb[1,2,3,4].  I recently used GParted to delete partition 2, and resize partition 1 to make partition 3 larger (this required moving the bytes forward on partition 3).
After doing this, I should automatically be left with three partitions: sdb[1,2,3]. But instead, I still have the partitions: sdb[1,3,4].

Normally, I use fdisk to fix the partition order, but this time that did not work:

[brian@Inspiron ~]$ sudo fdisk /dev/sdb

The number of cylinders for this disk is set to 77825.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006102a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10438    83843203+   7  HPFS/NTFS
/dev/sdb3           10444       65077   438847605   83  Linux
/dev/sdb4           65078       77825   102398310    b  W95 FAT32

Command (m for help): x

Expert command (m for help): p 

Disk /dev/sdb: 255 heads, 63 sectors, 77825 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 00   1   1    0 254  63 1023         63  167686407 07
 2 00   0   0    0   0   0    0          0          0 00
 3 00 254  63 1023 254  63 1023  167766795  877695210 83
 4 00 254  63 1023 254  63 1023 1045462005  204796620 0b

Expert command (m for help): f
Nothing to do. Ordering is correct already.


Expert command (m for help): q

[brian@Inspiron ~]$

As you can see, there is a non-existing partition on "sdb2," which is not reported by the standard-functionality "print partition table" of fdisk, but was when I used extra functionality.  The "partition" contains no bytes and has no starting point, or anything of the like.

What do I do about this?  I tried recreating and deleting a #2 partition, but that did not change anything.  Any help I would gladly appreciate.

Last edited by CheesyBeef (2009-04-03 21:32:12)

Offline

#2 2009-04-03 12:48:54

JF
Member
From: France
Registered: 2009-03-27
Posts: 39

Re: [SOLVED] Help deleting non-existing "partition" in fdisk?

Hi CheesyBeef,

I've had similar issues and tought I'm not expert in partitionning here's what I guessed:

- The partition table in the MBR contains 4 index entries (that you see with the expert print option of fdisk)
- The partitions are numbered in the order they are created, unless choosing a specific index entry to write into during partitionning
- Deleting a partiton means emptying the relative index entry, but the others stay untouched, therefore the numbering stays the same

In this case either you live with it or  you could try these:

- Backup the data of sda3 and sda4, edit the partition tables with an advanced partition table editor by moving the settings (hd, sec, cyl etc) of 2nd partition to 4th, 3rd to 2nd and 4th to 3rd, so the unused empty 2nd  partition becomes the last and "pushing" 2and 3 upwards.
I never tried this apart from changing the bootable flag from one partition to another so I don't know for sure if it'll work.
However what is certain is it will cause trouble to the operating systems expecting the old partition scheme, so you'll have to update the fstab and grub of the Linux one for example, if sda3 is a system partition.
During MS-DOS days Norton published a good "by hand" partition editor called PTEdit, now I don't know which one you could use with Linux.

- Backup the data of sda3 and sda4, delete sda3 and sda4, create sda2 and sda3 and put back your data into them. This way you'll have the same expected setup but also eventually the same troubles about OS expecting the old partition scheme.

Is this usefull / clear enough ?

Offline

#3 2009-04-03 16:10:12

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [SOLVED] Help deleting non-existing "partition" in fdisk?

If I were you - I would just ignore it - because otherwise your /etc/fstab will be out of whack and the same for your c:\boot.ini
You can put any id you like on a partition - as such. ie 'fdisk' explicitly asks you (for the primary partitions) which partition number you want. It is _not_ unusual to see people with only _one_ primary partition and then an extended partition. Your next partitions after that will be 5, 6, etc

As for boot-flag - you only need this if you are not using grub/lilo as your primary boot loader.

Offline

#4 2009-04-03 16:36:59

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: [SOLVED] Help deleting non-existing "partition" in fdisk?

Thank you guys both for your thorough responses smile

I guess I didn't really say it, but at the moment, this is just an external drive that holds data, and I create the NTFS partition so if I need to connect it to Windows and transfer something, I can.  And undoubtedly, if I changed the partition scheme or the attributes of a partition, I would check fstab and some of my other scripts for the device name and UUID's.

JF:  I was definitely considering your latter suggestion.  I think it seems a bit easier to do at least (though, I might try your first one just for a learning experience and to find a better partition editor).  I will just cp -a my data to my main hard drive, delete those partitions and recreate them, copy the data back.  I know this problem is not a huge deal, but I have some sort of OCD that won't let me forget about it smile

Hopefully, if all goes well, I won't have to even though partition #1, but we'll see!

Offline

#5 2009-04-03 18:42:55

JF
Member
From: France
Registered: 2009-03-27
Posts: 39

Re: [SOLVED] Help deleting non-existing "partition" in fdisk?

You're welcome ! Please let me know if you find a good partition editor during your experimentations smile

Offline

#6 2009-04-03 19:58:14

CheesyBeef
Member
Registered: 2008-06-04
Posts: 190

Re: [SOLVED] Help deleting non-existing "partition" in fdisk?

Ok, I ended up just backing up, deleting, and reformatting the partitions of the drive.  Everything went well and the drive now shows the following with fdisk:

[brian@Inspiron ~]$ sudo fdisk /dev/sdc

The number of cylinders for this disk is set to 77825.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdc: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006102a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       54175   435160656   83  Linux
/dev/sdc2           54176       67229   104856255    b  W95 FAT32
/dev/sdc3           67230       77825    85112370    7  HPFS/NTFS

Command (m for help): x

Expert command (m for help): p

Disk /dev/sdc: 255 heads, 63 sectors, 77825 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 00   1   1    0 254  63 1023         63  870321312 83
 2 00 254  63 1023 254  63 1023  870321375  209712510 0b
 3 00 254  63 1023 254  63 1023 1080033885  170224740 07
 4 00   0   0    0   0   0    0          0          0 00

Expert command (m for help): q

[brian@Inspiron ~]$

So I know have sdc[1,2,3].  All is good smile

I think I understand the extra-functionality partition table in Fdisk now.  It shows four primary partitions no matter if they exist or not.  I found the same thing with my system's internal hard drive; there are two similar blank sections in the partition table because I am only using two of the four primary partitions, the rest are logical.

Anyways, now I am almost sure that this problem could have been solved by finding a more advanced partition table editor.  I don't believe it had anything to do with a drive error or something necessary of the reformatting I did. 

Thanks again for your time and effort smile

Offline

Board footer

Powered by FluxBB