fdisk — Partition table entries are not in disk order, или восстанавливаем порядок разделов
Иногда может случиться так, что порядок разделов в таблице разделов меняется. Таким образом, что раздел (партиция) с номером x+2 оказывается физически между разделом x и x+1. Например, так, как это показано ниже:
$ sudo fdisk -l /dev/sda
…
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x000e3147
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 58593279 29295616 83 Linux
/dev/sda2 58595326 625141759 283273217 5 Extended
/dev/sda5 58595328 373270527 157337600 83 Linux
/dev/sda6 615235584 625141759 4953088 82 Linux swap / Solaris
/dev/sda7 373272576 615225239 120976332 83 Linux
Partition table entries are not in disk order
Как видно, раздел /dev/sda7 на самом деле расположен между /dev/sda5 и /dev/sda6.
В принципе, это не критично. Однако, если вы всё же хотите восстановить правильный порядок разделов, надо выполнить следующие простые действия:
1) Запускаем fdisk для требуемого раздела
$ sudo fdisk /dev/sda
2) Включаем расширенные команды:
Command (m for help): x
3) Правим порядок:
Expert command (m for help): f
Done.
4) Записываем изменения на диск:
Expert command (m for help): w
The partition table has been altered!
Собственно, всё, порядок разделов исправлен:
Command (m for help): p
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesU
Disk identifier: 0x000e3147
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 58593279 29295616 83 Linux
/dev/sda2 58595326 625141759 283273217 5 Extended
/dev/sda5 58595328 373270527 157337600 83 Linux
/dev/sda6 373272576 615225239 120976332 83 Linux
/dev/sda7 615235584 625141759 4953088 82 Linux swap / Solaris
Однако, если в вашем /etc/fstab прописаны диски по их названиям типа /dev/sdaX, а не по UUID, то вам следуем не забыть поправить fstab, так как названия поменялись. UUID же остались прежними.
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. Solve it
I also encounter this problem, and this is how I suppress the annoying warning!
The key point is: set the start to any logical sector, which is a multiple of 8
.
I set 204800
(because I can only choose from 65535-976773167).
step1 fdisk
$ fdisk /dev/sdf
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):d
已选择分区 1
分区 1 已删除
命令(输入 m 获取帮助):p
磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70
设备 Boot Start End Blocks Id System
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
# the key point
# ⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬
起始 扇区 (65535-976773167,默认为 65535): 204800 (chose a multiple of 8)
Last 扇区, +扇区 or +size{K,M,G} (204800-976773167,默认为 976773167):
将使用默认值 976773167
分区 1 已设置为 Linux 类型,大小设为 465.7 GiB
# 🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼🔼
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
step2 format the disk
$ mkfs.ext4 /dev/sdf1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=8191 blocks
30523392 inodes, 122071046 blocks
6103552 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2271215616
3726 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
step3 the result
And, finally the warning is disappear.
$ fdisk -l /dev/sdf
磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70
设备 Boot Start End Blocks Id System
/dev/sdf1 204800 976773167 488284184 83 Linux
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 500M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 170G 0 part
├─centos--sda-root 253:0 0 100G 0 lvm /
├─centos--sda-swap 253:1 0 20G 0 lvm
└─centos--sda-home 253:2 0 50G 0 lvm /home
sdb 8:16 0 1.8T 0 disk /data2
sdc 8:32 0 1.8T 0 disk
sdd 8:48 0 1.8T 0 disk /data1
sde 8:64 0 1.8T 0 disk /home
sdf 8:80 0 465.8G 0 disk
└─sdf1 8:81 0 465.7G 0 part
2.How this problem looks like
Show disk
[root@dt120 data1]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 500M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 170G 0 part
├─centos--sda-root 253:0 0 100G 0 lvm /
├─centos--sda-swap 253:1 0 20G 0 lvm
└─centos--sda-home 253:2 0 50G 0 lvm /home
sdb 8:16 0 1.8T 0 disk /data2
sdc 8:32 0 1.8T 0 disk
sdd 8:48 0 1.8T 0 disk /data1
sde 8:64 0 1.8T 0 disk /home
sdf 8:80 0 465.8G 0 disk
└─sdf1 8:81 0 465.7G 0 part
fdisk
$ fdisk /dev/sdf
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xff020bf0 创建新的 DOS 磁盘标签。
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
命令(输入 m 获取帮助):p
磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xff020bf0
设备 Boot Start End Blocks Id System
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (65535-976773167,默认为 65535):
将使用默认值 65535
Last 扇区, +扇区 or +size{K,M,G} (65535-976773167,默认为 976773167):
将使用默认值 976773167
分区 1 已设置为 Linux 类型,大小设为 465.7 GiB
命令(输入 m 获取帮助):p
磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0x2b6ce6ea
设备 Boot Start End Blocks Id System
/dev/sdf1 65535 976773167 488353816+ 83 Linux
Partition 1 does not start on physical sector boundary.
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 500M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 170G 0 part
├─centos--sda-root 253:0 0 100G 0 lvm /
├─centos--sda-swap 253:1 0 20G 0 lvm
└─centos--sda-home 253:2 0 50G 0 lvm /home
sdb 8:16 0 1.8T 0 disk /data2
sdc 8:32 0 1.8T 0 disk
sdd 8:48 0 1.8T 0 disk /data1
sde 8:64 0 1.8T 0 disk /home
sdf 8:80 0 465.8G 0 disk
└─sdf1 8:81 0 465.7G 0 part
format
$ mkfs.ext4 /dev/sdf1
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdf1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=8191 blocks
30523392 inodes, 122088454 blocks
6104422 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2271215616
3726 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
the problem
Partition 1 does not start on physical sector boundary.
$ fdisk -l /dev/sdf
磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70
设备 Boot Start End Blocks Id System
/dev/sdf1 65535 976773167 488353816+ 83 Linux
Partition 1 does not start on physical sector boundary.
В предыдущем посте я писал о проблеме неправильно распределённого ЖД и уменьшении размера с корневой директорией. На этот раз раберёмся с 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)
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- New to Ubuntu
- [SOLVED] Partition table entries are not in disk order=?Problem
-
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.
-
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.
-
Re: Partition table entries are not in disk order=?Problem
Here’s a screeshot of Gparted showing the partitions set up.
-
Re: Partition table entries are not in disk order=?Problem
Originally Posted by drs305
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
-
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.
-
Re: Partition table entries are not in disk order=?Problem
Originally Posted by drs305
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.
-
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.
-
Re: Partition table entries are not in disk order=?Problem
Originally Posted by mikodo
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.
-
Re: Partition table entries are not in disk order=?Problem
Originally Posted by drs305
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.)
Originally Posted by drs305
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.
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.
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.
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
#1 2020-03-05 22:03:41
- archdom
- Member
- Registered: 2018-09-12
- Posts: 96
[SOLVED]Partition table entries are not in disk order
Hi guys,
when i run fdisk -l i get the following message:
Partition table entries are not in disk order.
Some solved it by running fdisk with the f (fix partitions order) option.
They say that if you don’t have references with /dev/nvmeXX but UUID references of the partitions there shouldn’t be any problems.
fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p9
UUID=b177476c-53c0-4a8f-bac2-3955040ce0b3 / ext4 rw,relatime 0 1
# /dev/nvme0n1p7
UUID=B26C-A1E5 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/nvme0n1p10
UUID=a25a996b-c90a-4597-9fb6-cdaa2ebf6de3 /home ext4 rw,relatime 0 2
# /dev/nvme0n1p8
UUID=3915a4f1-d3de-4ada-964a-09fef8733b5f none swap defaults 0 0
partial grub.cfg
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-b177476c-53c0-4a8f-bac2-3955040ce0b3' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root B26C-A1E5
else
search --no-floppy --fs-uuid --set=root B26C-A1E5
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=b177476c-53c0-4a8f-bac2-3955040ce0b3 rw intel_iommu=on video=1920x1080 resume=UUID=3915a4f1-d3de-4ada-964a-09fef8733b5f verbose
echo 'Loading initial ramdisk ...'
initrd /intel-ucode.img /initramfs-linux.img
}
As you can see there are references only to UUIDs.
If they change the name of the various / dev / nvmeXX there should be no problems with booting (grub) and mounting (fstab).
Can you confirm?
nb: that message annoys me
Last edited by archdom (2020-03-06 09:24:00)
#2 2020-03-05 22:49:13
- frostschutz
- Member
- Registered: 2013-11-15
- Posts: 1,243
Re: [SOLVED]Partition table entries are not in disk order
even though it’s just a comment and won’t affect functionality, I’d still remove those device names from comment (or update them accordingly). bad documentation can be confusing, and confusion can lead to errors…
also run a grep just in case, as there might be other files (like crypttab, mdadm.conf, smartd.conf, …) that might also reference to devices by name instead of UUID
in general UUID has exactly this purpose… identify things by content, regardless of device name. only causes problems when you duplicate content (like dd cloning). two devices with same uuid, it can’t pick the correct one.
Last edited by frostschutz (2020-03-05 22:51:18)
#3 2020-03-06 09:23:21
- archdom
- Member
- Registered: 2018-09-12
- Posts: 96
Re: [SOLVED]Partition table entries are not in disk order
it worked!
I had to regenerate grub.cfg beacuse arch boot was missing via arch-chroot command.
Before run arch-chroot command, i have regenerate fstab file so now i have also correct name of partitions.
Mark as solved
#4 2020-03-06 09:26:19
- archdom
- Member
- Registered: 2018-09-12
- Posts: 96
Re: [SOLVED]Partition table entries are not in disk order
I want to remind all users that it is a modification that requires manual intervention.
see you next time
- Печать
Страницы: [1] 2 Все Вниз
Тема: Проблемы с жестким диском (Прочитано 1950 раз)
0 Пользователей и 1 Гость просматривают эту тему.

funk2256
Добрый день, имеется ноутбук с жестким диском который был разбит на две части как мне сказали.
Я же под ubuntu вижу только целый жесткий. Не вижу куска, огромного, но жесткий определяется как цельный.
Есть выхлоп с fdisk но я в нем немогу разобраться немного, нужна помощ уважаемые.
« Последнее редактирование: 09 Апреля 2016, 21:03:39 от Alex_ander »
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд
symon2014

funk2256
« Последнее редактирование: 09 Апреля 2016, 21:03:58 от Alex_ander »
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд
symon2014
Честное пионерское — вижу диск 500 гиг( размеченный и содержащий неизвестно что(только без Ubuntu)), и флешку(8 гиг), наверно с неё загружен. Можно больше инфы. Например скрин гпартед и подтверди(загружен сейчас с флешки с убунтой?)(какая версия)?

funk2256
Да, я сижу с флешки с лайва. 14.04 версия.
Вложение скрина в архиве.
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд
symon2014

userok2008
Мне интересно, почему в первом «выхлопе» говорится, что это «не выглядит как таблица разделов, возможно вы неправильно выбрали устройство», а во втором виден винт с 3-мя разделами, первый виндовый, второй такой же, но загрузочный, а третий-досовский.
Первый «выхлоп» какой командой делался?)))
Debian Squeeze 6.10 PPC/i486, Wheezy 7.8 PPC/i686, Jessie 8.2 i686

funk2256
То что я вижу на том жестком была винда с загрузочником и файлы типа /фотки/фильмы и прочее хотелось бы вытащить все то, что там лежит.
то и есть основная задача, а дальше можно крушить и ломать)
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд
symon2014
userok2008, у ТС написано fdisk , но на скрине пусто.

funk2256
Мне интересно, почему в первом «выхлопе» говорится, что это «не выглядит как таблица разделов, возможно вы неправильно выбрали устройство», а во втором виден винт с 3-мя разделами, первый виндовый, второй такой же, но загрузочный, а третий-досовский.
Первый «выхлоп» какой командой делался?)))
/sbin/fdisk -l /dev/sda1
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд

userok2008
funk2256,
По первому выхлопу понятно-правильную команду вам уже успели подсказать.
На скрине не видно-флаг boot(*) на каком разделе-который побольше или который 100мб?И да, gparted говорит о проблемах файловой системы на большом виндовом разделе, второй восклицательный, под неизвестной фс, это виндовый скрытый раздел восстановления, должен быть по идее)
Так какой раздел загрузочный, и есть ли скрытый?
Debian Squeeze 6.10 PPC/i486, Wheezy 7.8 PPC/i686, Jessie 8.2 i686

funk2256
funk2256,
По первому выхлопу понятно-правильную команду вам уже успели подсказать.
На скрине не видно-флаг boot(*) на каком разделе-который побольше или который 100мб?И да, gparted говорит о проблемах файловой системы на большом виндовом разделе, второй восклицательный, под неизвестной фс, это виндовый скрытый раздел восстановления, должен быть по идее)
Так какой раздел загрузочный, и есть ли скрытый?
Как я понял загрузочный на том разделе был, который поменьше. У меня огромное ощущение, что проблема еще и в таблице разделов, сейчас жду отчет
gpart -if /dev/sda1
Накопал вот тут статейку
Пользователь решил продолжить мысль 14 Августа 2015, 19:42:34:
Пардон, флаг boot на разделе в 100 мб стоит. посмотрел.
« Последнее редактирование: 14 Августа 2015, 19:42:34 от funk2256 »
Feci quod potui, faciant meliora potentes.(Я сделал всё, что смог, пусть те, кто смогут, сделают лучше)
Новичкам
Шпаргалка команд

Olej
Судя по скрину, на диске ничего нет , кроме бардака.
Это вам он кажется бардаком.
Это диск, может быть создан ОС QNX, или Solaris, такими же UNIX-like, как и ваша Ubuntu, которые в первом разделе могли создавать слайсы (подразделы).
Поскольку пользоваться ним в QNX ТС не планирует — можно всё сносить и переразбивать.
« Последнее редактирование: 14 Августа 2015, 19:49:59 от Olej »

userok2008
funk2256,
вы это не читайте-это не ваш случай)
пока не поправите фс на большом виндовом разделе-файлов не достанете.
думаю, вам будет проще загрузить лив-сд виндовый с r-studio или подобным софтом и просто «вытащить» нужные файлы.
Восстановление осложняется тем-что это похоже был системный раздел с виндой).
У вас там MBR и любые неправильные действия «похоронят» ваши файлы навсегда).Если Gparted на него не «ругается» знач проблем с разметкой быть не должно.
Debian Squeeze 6.10 PPC/i486, Wheezy 7.8 PPC/i686, Jessie 8.2 i686
symon2014
- Печать
Страницы: [1] 2 Все Вверх