2

For a few days i'm breaking my head over the following:

  • the partition table is reported to be messed up, but it's not.
  • grub-legacy gives problems with some partitions during actual boot-up, but not when invoked in a shell when linux is up-and-running.

I suspect the two symptoms are related, but i'm not sure.

Background information:

  • Grub-legacy has been booting from an XFS on /dev/sda4 a.k.a. (hd0,3) for years without trouble.
  • Things got messed up when resizing the FAT32 filesystem on sda1 using Gparted (apparently there is a bug in libparted 3.2 responsible for this). Suddenly grub couldn't access sda4 anymore.

Here is the output from fdisk concerning th broken-not-broken partition table:

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 74.5 GiB, 80026361856 bytes, 156301488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x85068506

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            2048   8390655   8388608    4G  c W95 FAT32 (LBA)
/dev/sda2  *      8390656  29296639  20905984   10G  7 HPFS/NTFS/exFAT
/dev/sda3        29296640 136712191 107415552 51.2G  f W95 Ext'd (LBA)
/dev/sda4       136712192 156301487  19589296  9.3G 83 Linux
/dev/sda5        29298688  33492991   4194304    2G 83 Linux
/dev/sda6        33495040  75438079  41943040   20G 83 Linux
/dev/sda7        75440128  83828735   8388608    4G 83 Linux
/dev/sda8        83830784  88025087   4194304    2G 83 Linux
/dev/sda9        88027136  94318591   6291456    3G 82 Linux swap

Partition table entries are not in disk order.

Command (m for help): x

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

parted lists the partition table as follows:

# parted /dev/sda unit s print free                                                    
Model: ATA WDC WD800JB-00JJ (scsi)
Disk /dev/sda: 156301488s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start       End         Size        Type      File system     Flags
        63s         2047s       1985s                 Free Space
 1      2048s       8390655s    8388608s    primary   fat32           boot, lba
 2      8390656s    29296639s   20905984s   primary   ntfs
 3      29296640s   136712191s  107415552s  extended                  lba
 5      29298688s   33492991s   4194304s    logical   ext2
 6      33495040s   75438079s   41943040s   logical   ext3
 7      75440128s   83828735s   8388608s    logical   ext3
 8      83830784s   88025087s   4194304s    logical   ext3
 9      88027136s   94318591s   6291456s    logical   linux-swap(v1)
        94318592s   136712191s  42393600s             Free Space
 4      136712192s  156301487s  19589296s   primary   ext2

About grub during boot-up:

  • it reports "Error 5: partition table invalid or corrupt" for sda7 and sda8.
  • it reports "Filesystem type unknown" for sda4, though it's a simple ext2 (by now).

I've searched many many forums/wikis/etc, but haven't solved this puzzle yet. I've only come to realise my partition table is 1MiB-aligned (hence the 2048 sector gaps). I've done some partition deletion/recreation/reformatting/checking etc, without success.

I'm running slackware 14.2 (salix, actually) with kernel 3.10. All linux filesystems are ext2 or ext3.

I'm very curious to find the cause of these symptoms. Please help me to tackle this.

1

The reason it says Partition table entries are not in disk order. is because they aren't. Your sda4 is at the end of the disk, but sda5-9 is located before that.

In parted the output should look something like this:

# parted /dev/loop0 unit s print free
Model: Loopback device (loopback)
Disk /dev/loop0: 156301488s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start       End         Size        Type      File system  Flags
        63s         2047s       1985s                 Free Space
 1      2048s       8390655s    8388608s    primary                lba
 2      8390656s    29296639s   20905984s   primary                boot
 3      29296640s   136712191s  107415552s  extended               lba
 5      29298688s   33492991s   4194304s    logical
 6      33495040s   75438079s   41943040s   logical
 7      75440128s   83828735s   8388608s    logical
 8      83830784s   88025087s   4194304s    logical
 9      88027136s   94318591s   6291456s    logical
        94318592s   136712191s  42393600s             Free Space
 4      136712192s  156301487s  19589296s   primary

Note that's just the explanation about the fdisk message. If you convert the last primary partition to a logical one, the message goes away. I'm not sure if that is related in any way whatsoever to your other partition problems.

  • In parted the output actually does look exactly like your example. I've added the output to the question. Apparently parted and fdisk just differ in the way how they present logical partitions: fdisk orders them by number, and therefore always after the primary partitions, and parted orders them by order on disk. – plons May 10 '17 at 20:09
  • AFAIK fdisk makes more sense in this, since information about logical partitions is not stored in the MBR but further down the disk, in the extended partition itself. – plons May 10 '17 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.