Partition table entries are not in disk order как исправить

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.

В предыдущем посте я писал о проблеме неправильно распределённого ЖД и уменьшении размера с корневой директорией. На этот раз раберёмся с LVM (по мотивам этой статьи).

В отличии от предыдущего раза, мне не нужен установочный диск Debian, т.к. LVM можно создать на работающей системе.

После предыдущих экспериментов мне достались следующие разделы:

> sudo fdisk -lc /dev/sda

Disk /dev/sda: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 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: 0x00049f1f

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1         263     2109440   83  Linux

/dev/sda2            1998        2089      731137    5  Extended

/dev/sda3             263        1998    13934591   83  Linux

/dev/sda5            1998        2089      731136   82  Linux swap / Solaris

Partition table entries are not in disk order

Для чистоты эксперимента, я смело могу удалять всё, кроме sda1.

Для начала отключим существующий swap (для начала проверим состояние):

> cat /proc/swaps

Filename                                Type            Size    Used    Priority

/dev/sda5                               partition       731128  0       -1

Всё нормально, в swap нет данных, можно отключать:

> sudo swapoff /dev/sda5

Проверяем, действительно ли отключен (следующая команда аналогична cat /proc/swaps):

> swapon -s             

Filename                                Type            Size    Used    Priority

Удаляем из файла /etc/fstab строку:
UUID=4771bdd4-e219-4b8f-920a-9d5460b47ff6 none            swap    sw              0       0

Удаляем разделы:

> sudo fdisk  /dev/sda 

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

         switch off the mode (command ‘c’) and change display units to

         sectors (command ‘u’).

Command (m for help): c

DOS Compatibility flag is not set

Command (m for help): u

Changing display/entry units to sectors

Command (m for help): d

Partition number (1-5): 2

Command (m for help): d

Partition number (1-4): 3

Command (m for help): p

Disk /dev/sda: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders, total 33554432 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

Disk identifier: 0x00049f1f

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     4220927     2109440   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Устройство или ресурс занято.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

Для того, чтобы изменения вступили в силу, необходимо перезагрузиться.

Всю не размеченную область я отдам под LVM:

> sudo fdisk /dev/sda  

[sudo] password for sabo: 

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

         switch off the mode (command ‘c’) and change display units to

         sectors (command ‘u’).

Command (m for help): c

DOS Compatibility flag is not set

Command (m for help): u

Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sda: 17.2 GB, 17179869184 bytes

189 heads, 54 sectors/track, 3287 cylinders, total 33554432 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

Disk identifier: 0x00049f1f

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     4220927     2109440   83  Linux

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 2

First sector (4220928-33554431, default 4220928): 

Using default value 4220928

Last sector, +sectors or +size{K,M,G} (4220928-33554431, default 33554431): 

Using default value 33554431

Command (m for help): t

Partition number (1-4): 2

Hex code (type L to list codes): 8e

Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sda: 17.2 GB, 17179869184 bytes

189 heads, 54 sectors/track, 3287 cylinders, total 33554432 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

Disk identifier: 0x00049f1f

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     4220927     2109440   83  Linux

/dev/sda2         4220928    33554431    14666752   8e  Linux LVM

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Устройство или ресурс занято.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

Обратите внимание, что я установил тип раздела 8e (Linux LVM).

Теперь необходимо установить ПО для работы с LVM:

> sudo aptitude install lvm2

Следующие НОВЫЕ пакеты будут установлены:        

  lvm2 

0 пакетов обновлено, 1 установлено новых, 0 пакетов отмечено для удаления, и 0 пакетов не обновлено.

Необходимо получить 448 kB архивов. После распаковки 1 077 kB будет занято.

Получено 448 kБ в 1с (309 kБ/с)

Выбор ранее не выбранного пакета lvm2.

(Чтение базы данных … на данный момент установлено 39064 файла и каталога.)

Распаковывается пакет lvm2 (из файла …/lvm2_2.02.66-5_amd64.deb)…

Обрабатываются триггеры для man-db …

Настраивается пакет lvm2 (2.02.66-5) …

Setting up LVM Volume Groups  Reading all physical volumes.  This may take a while…

  No volume groups found

  No volume groups found

  No volume groups found

.

update-initramfs: deferring update (trigger activated)

Обрабатываются триггеры для initramfs-tools …

update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64

Перезагружаемся.

> sudo fdisk -lc /dev/sda

Disk /dev/sda: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 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: 0x00049f1f

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1         263     2109440   83  Linux

/dev/sda2             263        2089    14666752   8e  Linux LVM

Раздел по LVM создан – осталось настроить сам LVM.

Сначала инициализируем созданный раздел:

> sudo pvcreate /dev/sda2

  Physical volume “/dev/sda2” successfully created

Создаём группу томов (я назову её server):

> sudo vgcreate server /dev/sda2

  Volume group “server” successfully created

Посмотрим, что получилось:

> sudo vgscan

  Reading all physical volumes.  This may take a while…

  Found volume group “server” using metadata type lvm2

Активируем созданный LVM:

> sudo vgchange -ay

  0 logical volume(s) in volume group “server” now active

И начинаем создавать логические диски:

> sudo lvcreate -L 1G -n swap server

  Logical volume “swap” created

> sudo lvcreate -L 1G -n tmp server 

  Logical volume “tmp” created

> sudo lvcreate -L 1G -n root server

  Logical volume “root” created

> sudo lvcreate -L 2G -n home server

  Logical volume “home” created

> sudo lvcreate -L 2G -n usr server 

  Logical volume “usr” created

> sudo lvcreate -L 2G -n srv server

  Logical volume “srv” created

Смотрим, что получилось:

> sudo lvscan 

  ACTIVE            ‘/dev/server/swap’ [1,00 GiB] inherit

  ACTIVE            ‘/dev/server/tmp’ [1,00 GiB] inherit

  ACTIVE            ‘/dev/server/root’ [1,00 GiB] inherit

  ACTIVE            ‘/dev/server/home’ [2,00 GiB] inherit

  ACTIVE            ‘/dev/server/usr’ [2,00 GiB] inherit

  ACTIVE            ‘/dev/server/srv’ [2,00 GiB] inherit

Итого мы создали 6 новых разделов.

> sudo pvscan

  PV /dev/sda2   VG server   lvm2 [13,98 GiB / 4,98 GiB free]

  Total: 1 [13,98 GiB] / in use: 1 [13,98 GiB] / in no VG: 0 [0   ]

Но при этом у нас осталось почти 5 Гб неразмеченного пространства. LVM позволяет гибко изменять разделы томов, т.ч. оставлю его в резерве.

Форматируем разделы:

> sudo mkfs.ext4 /dev/server/home

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

131072 inodes, 524288 blocks

26214 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            

Creating journal (16384 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

> sudo mkfs.ext4 /dev/server/root 

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

65536 inodes, 262144 blocks

13107 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=268435456

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376

Writing inode tables: done                            

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

> sudo mkfs.ext4 /dev/server/srv 

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

131072 inodes, 524288 blocks

26214 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            

Creating journal (16384 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

> sudo mkfs.ext4 /dev/server/tmp 

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

65536 inodes, 262144 blocks

13107 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=268435456

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376

Writing inode tables: done                            

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

> sudo mkfs.ext4 /dev/server/usr 

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

131072 inodes, 524288 blocks

26214 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            

Creating journal (16384 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

Форматируем swap:

> sudo mkswap -f /dev/server/swap

Setting up swapspace version 1, size = 1048572 KiB

no label, UUID=13ad3312-8b76-4018-8e3e-6cbbc94a807f

Мне пришлось использовать аргумент -f, т.к. вылезает ошибка “warning: don’t erase bootbits sectors on whole disk.”.

В результате мы получили тома со следующими идентификаторами:

> sudo blkid 

/dev/sda1: UUID=”653ac5dc-ea55-4c75-be36-e54e26d078e1″ TYPE=”ext3″ 

/dev/sda2: UUID=”mkkLen-vzQr-KFRA-rJCe-h4dw-Irj8-GIfNsi” TYPE=”LVM2_member” 

/dev/mapper/server-swap: UUID=”13ad3312-8b76-4018-8e3e-6cbbc94a807f” TYPE=”swap” 

/dev/mapper/server-tmp: UUID=”19ab2a02-6ff2-4870-b834-f0c992f577d2″ TYPE=”ext4″ 

/dev/mapper/server-root: UUID=”854a4bc0-eb17-4639-b298-35f3367cbc83″ TYPE=”ext4″ 

/dev/mapper/server-home: UUID=”f971ccfb-4391-4ad0-bf49-885406800783″ TYPE=”ext4″ 

/dev/mapper/server-usr: UUID=”13e6e8a9-4aa8-467c-8995-fe3d52f1f8c6″ TYPE=”ext4″ 

/dev/mapper/server-srv: UUID=”b178a220-5548-44e6-ac81-4d7ec5dd1373″ TYPE=”ext4″

Прописываем swap:

В файл /etc/fstab добавляем следующую строчку:
UUID=13ad3312-8b76-4018-8e3e-6cbbc94a807f none            swap    sw              0       0

Запускаем swap:

> sudo swapon -va

swapon on /dev/mapper/server-swap

swapon: /dev/mapper/server-swap: found swap signature: version 1, page-size 4, same byte order

swapon: /dev/mapper/server-swap: pagesize=4096, swapsize=1073741824, devsize=1073741824

Смотрим, что получилось:

> cat /proc/swaps

Filename                                Type            Size    Used    Priority

/dev/dm-0                               partition       1048568 0       -1

Пробуем смонтировать ext4 раздел:

> sudo mount /dev/server/home /mnt

У меня раздел смонтирован успешно:

> mount

/dev/sda1 on / type ext3 (rw,errors=remount-ro)

tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)

proc on /proc type proc (rw,noexec,nosuid,nodev)

sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)

udev on /dev type tmpfs (rw,mode=0755)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)

i have asked about Gparted doesn’t detect any partitions and i tried the command :

sudo fdisk -l

and the result is (after partition info ) :

Partition table entries are not in disk order

so how to fix this problem , please help me .
thanks

Community's user avatar

asked Jun 10, 2010 at 11:00

Radi's user avatar

Firstly, if any partitions take up partial blocks (those will have a + in the values) then this won’t work.

Record the partition values, delete the partitions that are out of order, recreate them in proper order, then change anything like the grub config or /etc/fstab that may list the partitions by number instead of label.

answered Jun 10, 2010 at 11:07

Ignacio Vazquez-Abrams's user avatar

I am in need of some help. I am completely new to linux. I have created and installed a Ubuntu 10.04 server as a virtual machine that is running in a Citrix Xenserver 5.6 Fp1 environment.

While I have struggled a bit here and there, everything seems to work ok. I have a proxy server running on this machine for my users, and I have recently added kerio mail server. This is where I found an issue. (I think). While browsing the machines running processes using “top” it appeared to me that the entire amount of my memory was being maxed out, while my swap drive is never touched. I do recall during the setup of this machine that I did have a little trouble setting up the drives. By that I mean, I wasn’t feeling all warm and fuzzy that I did it right. Well, I think now, I can definitely say that I think I have it wrong. It appears that my drives are a bit jacked up to say the least. Here is the order of the “jackedupness”… and below that is what I get when I run “fdisk -l”

Any help would be gratefully accepted.

  1. Partition 1 does not end on cylinder boundary.
  2. Partition table entries are not in disk order
  3. Disk /dev/xvdd doesn’t contain a valid partition table
$ sudo fdisk -l
Disk /dev/xvda: 193.3 GB, 193273528320 bytes
255 heads, 63 sectors/track, 23497 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: 0x000aa4f5

Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1          32      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2           23255       23498     1951744   82  Linux swap / Solaris
/dev/xvda3              32       23255   186540033    5  Extended
/dev/xvda5              32       23255   186540032   8e  Linux LVM

Partition table entries are not in disk order

Disk /dev/xvdd: 66 MB, 66891776 bytes
255 heads, 63 sectors/track, 8 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: 0x00000000

Disk /dev/xvdd doesn't contain a valid partition table

Thank you in advance,

Casey

sudo parted -l

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu-tmp: 998MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  998MB  998MB  ext3

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu-home: 5000MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  5000MB  5000MB  ext3

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu-var: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  160GB  160GB  ext3

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu-root: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  ext3

Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 193GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size    Type      File system     Flags
 1      1049kB  256MB  255MB   primary   ext3
 3      257MB   191GB  191GB   extended
 5      257MB   191GB  191GB   logical                   lvm
 2      191GB   193GB  1999MB  primary   linux-swap(v1)

Error: /dev/xvdd: unrecognised disk label                                 

Results of the swapon -s

swapon -s
Filename                Type        Size    Used    Priority
/dev/xvda2                              partition   1951736 0   -1

fstab contents

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/ubuntu-root /               ext3    errors=remount-ro 0       1
# /boot was on /dev/xvda1 during installation
UUID=762d244c-df00-401e-a06b-b4d98316b5b3 /boot           ext3    defaults        0       2
/dev/mapper/ubuntu-home /home           ext3    defaults        0       2
/dev/mapper/ubuntu-tmp /tmp            ext3    defaults        0       2
/dev/mapper/ubuntu-var /var            ext3    defaults        0       2
# swap was on /dev/xvda2 during installation
UUID=87884241-3fa5-46c9-aef2-8144c08ac49c none            swap    sw              0       0

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • New to Ubuntu
  • [SOLVED] Partition table entries are not in disk order=?Problem

  1. Partition table entries are not in disk order=?Problem

    Hello everyone,

    Just did a sudo fdisk -l of my newly installed OS. I had manually configured the partitions with the Live CD install to allow for my /home to be on it’s own partition. The included screenshot of same indicates that my Partition table entries are not in disk order. Is this something I should correct? Can I expect problems with the partitioning as it is? If so, what should I do?

    I must go to bed, and will not be available for answering of questions immediately. Sorry.

    Thank you.

    Last edited by mikodo; August 29th, 2009 at 10:57 AM.


  2. Re: Partition table entries are not in disk order=?Problem

    It is not a problem. You can “reset” them to the correct order but you would need to check your grub menu and fstab in case there were any references to “sdXX” instead of to UUIDs. The reason is at least two of the partition “sdXX” designations would change after you ‘reset’ them.

    For those wishing to do so, here is the procedure. Note that your system will operate fine without making this change and you run the risk of screwing up your boot process or partition mounting if the partition designations no longer match in fstab or menu.lst:

    Code:

    sudo fdisk /dev/sda

    at the prompt:
    m (for help)
    at the prompt:

    x (extra functionality – experts only)
    f (fix)
    w (write to disk and exit)
    You may get a warning that devices are in use and the new table will be used at the next boot.
    Check fstab and menu.lst before rebooting.
    Repeat for other drives.

    Last edited by drs305; August 29th, 2009 at 11:01 AM.


  3. Re: Partition table entries are not in disk order=?Problem

    Here’s a screeshot of Gparted showing the partitions set up.


  4. Smile Re: Partition table entries are not in disk order=?Problem

    Quote Originally Posted by drs305
    View Post

    It is not a problem. You can “reset” them to the correct order but you would need to check your grub menu and fstab in case there were any references to “sdXX” instead of to UUIDs. The reason is at least two of the partition “sdXX” designations would change after you ‘reset’ them.

    For those wishing to do so, here is the procedure. Note that your system will operate fine without making this change and you run the risk of screwing up your boot process or partition mounting if the partition designations no longer match in fstab or menu.lst:

    Code:

    sudo fdisk /dev/sda

    at the prompt:
    m (for help)
    at the prompt:

    x (extra functionality – experts only)
    f (fix)
    w (write to disk and exit)
    You may get a warning that devices are in use and the new table will be used at the next boot.
    Check fstab and menu.lst before rebooting.
    Repeat for other drives.

    Wow, thanks for the quick and detailed explanation. This is stuff that is not something I will attempt as a Newbie, especially that you were kind enough to assure me twice in response that it is not a problem and the system would operate fine as it is. For those with similar configurations and knowledge and skill to follow the posters advice, have at it, if you wish. He is obviously an expert.

    Thank you,

    mikodo


  5. Re: Partition table entries are not in disk order=?Problem

    Hello.

    Just some additional notes:

    You may only have 4 primary partitions, so if you set up your partition table with only 3 primary partitions and one of them as an extended, this will always be out of order.

    Your dmesg should also show how your current set up looks like.

    Basically it doesnt really matter if they’re out of order, just add labels to all your partitions and you can easily access them.

    Just, why the good god do you have a 8GB swap partition?

    o.O

    I assume your PC is quite young, so swappoff and do something useful with the space.

    It won’t render your system unstable if you swap off, so you could do this live, resize the swap partition to like 1GB max, and then go for whatever comes to your mind with the freed space.


  6. Re: Partition table entries are not in disk order=?Problem

    Quote Originally Posted by drs305
    View Post

    It is not a problem. You can “reset” them to the correct order but you would need to check your grub menu and fstab in case there were any references to “sdXX” instead of to UUIDs. The reason is at least two of the partition “sdXX” designations would change after you ‘reset’ them.

    For those wishing to do so, here is the procedure. Note that your system will operate fine without making this change and you run the risk of screwing up your boot process or partition mounting if the partition designations no longer match in fstab or menu.lst:

    Code:

    sudo fdisk /dev/sda

    at the prompt:
    m (for help)
    at the prompt:

    x (extra functionality – experts only)
    f (fix)
    w (write to disk and exit)
    You may get a warning that devices are in use and the new table will be used at the next boot.
    Check fstab and menu.lst before rebooting.
    Repeat for other drives.

    Hello; It still is bothering me that my Partition table entries are not in order. Do the screenshots of my fstab and grub menu indicate that it is safe to run the above quoted code to fix them?

    Thank you.


  7. Smile Re: Partition table entries are not in disk order=?Problem

    Hello everyone,

    I went ahead and run the above code, and now my Partition table entries are in order. Please see screenshot of same.

    Thank you all.


  8. Re: Partition table entries are not in disk order=?Problem

    Quote Originally Posted by mikodo
    View Post

    Hello everyone,

    I went ahead and run the above code, and now my Partition table entries are in order. Please see screenshot of same.

    Thank you all.

    Glad it worked out. In checking those two files, what I would have looked for is any “sdXX” entry, such as sda5, instead of the (now) expected UUIDs. If everything is referenced by UUID, then the command won’t create any boot or mount issues.


  9. Re: Partition table entries are not in disk order=?Problem

    Quote Originally Posted by drs305
    View Post

    For those wishing to do so, here is the procedure.

    FWIW, when only logical partitions are out of order, my FixParts program does this automatically — just launch the program and type “w” to save the changes. (It’s always wise to verify you’re working on the right disk by typing “p” to check the partitions, though. This also lets you verify that the partitioning tool has correctly read all the partitions.)

    Quote Originally Posted by drs305
    View Post

    It is not a problem.

    I’d like to reiterate this point, and add that there’s always a risk of damage when messing with partition tables. I know that mikodo has done the modification without problems, but an error (user error, a bug in a program, a power failure at exactly the wrong moment, etc.) can cause the partition definitions to be lost, and that will take a lot of effort to correct. It’s just not worth the risk for something like this. Note that there’s no “IMHO” in that statement.

    Quote Originally Posted by loomsen

    You may only have 4 primary partitions, so if you set up your partition table with only 3 primary partitions and one of them as an extended, this will always be out of order.

    Not quite; with that setup, there will necessarily be a gap in the numbering, but the partitions that are there can be in order.

    Quote Originally Posted by loomsen

    Your dmesg should also show how your current set up looks like.

    The dmesg command displays the kernel ring buffer, which contains messages generated by the kernel. Mostly these relate to hardware detection and errors. Among many other things, these messages will show you how many partitions you’ve got and how they’re numbered, but they won’t say anything about partition sizes. For instance:

    Code:

    [    5.499096] sd 1:0:1:0: [sdb] 625142448 512-byte logical blocks: (320 GB/298 GiB)
    [    5.499129] sd 1:0:1:0: [sdb] Write Protect is off
    [    5.499131] sd 1:0:1:0: [sdb] Mode Sense: 00 3a 00 00
    [    5.499149] sd 1:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    [    5.499235]  sdb: sdb1 sdb2 sdb3

    That last line indicates the disk has three partitions, /dev/sdb1 through /dev/sdb3. (On a disk with extended and logical partitions, that arrangement is indicated, IIRC.) There’s nothing there about partition sizes or types. For such information, you’ve got to use a partitioning tool like fdisk, parted, GParted, or gdisk.

    Quote Originally Posted by aj_84@live.co.uk

    can you help me how to put this in order, i have three primary partition and one extended partition. I just want to get the linux versions together.

    Your Linux partitions are contiguous in on-disk space; the last two (your logical partitions) are just out of order in their numbering sequence. This is unimportant, and as I wrote earlier, changing your partitions just to “fix” this is inadvisable. Basically, your disk isn’t broken, and there’s wisdom to the saying, “if it ain’t broke, don’t fix it.”

    FWIW and for future reference, it’s generally best to put a swap partition in-between Linux partitions (in terms of actual partition sectors, not necessarily the partition numbers). This minimizes head seek movements when accessing swap space, thus improving performance. Since swap space is rarely used today, though, I wouldn’t advise trying to change your existing configuration; you’ll spend more time trying to improve performance than you could possibly save by optimizing your swap file placement, and you’ll run the risk of creating bigger problems. It’s just something to keep in mind for the next time you partition a disk.

    If I’ve suggested a solution to a problem and you’re not the original poster, do not try my solution! Problems can seem similar but be different, and a good solution to one problem can make another worse. Post a new thread with your problem details.


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

Добавить комментарий