gparted 无法在 ubuntu 14.04 上运行,但在 ubuntu 10.04 上运行正常的磁盘上却不行

gparted 无法在 ubuntu 14.04 上运行,但在 ubuntu 10.04 上运行正常的磁盘上却不行

考虑到要使用 ubuntu 14.04,我尝试启动实时 DVD,看看它如何查看我的硬盘设置。在我的常规 10.04 安装中,硬盘(我使用 gparted 配置)工作正常:

$ parted /dev/sda
GNU Parted 2.2
Using /dev/sda
(parted) print                                                            
Model: ATA TOSHIBA DT01ACA3 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  37.7GB  37.7GB  ext3               boot
 3      37.7GB  37.7GB  32.9MB                     bios_grub
 2      37.7GB  3001GB  2963GB                     raid

(parted) quit       

当我启动到 14.04 时,gparted 抱怨它无法查询驱动器,提示我重试忽略或取消,然后显示硬盘未配置(不包含分区)

14.04 下的 gdisk 说分区表已损坏。10.04 下的 gdisk 说分区表正常。

相同的工具在相同的硬件上怎么可能产生不同的结果?我甚至尝试使用 ubuntu 10.04 的 live dvd 启动,看看是否是由 cd 启动引起的,但事实并非如此。即使从 dvd 启动,磁盘在 10.04 中似乎也很好。

14.04 的一些结果:

parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Error: Invalid argument during seek for read on /dev/sda
Retry/Ignore/Cancel? c
Model: ATA TOSHIBA DT01ACA3 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags: 
(parted) print                                                            
Error: Invalid argument during seek for read on /dev/sda
Retry/Ignore/Cancel? i                                                    
Error: The backup GPT table is corrupt, but the primary appears OK, so that will
be used.
OK/Cancel? o                                                              
Model: ATA TOSHIBA DT01ACA3 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags: 
(parted) q


gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.8

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help): q

` 以及 10.04:

fdisk -l /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      267350  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.
root@user-desktop:~# gdisk /dev/sda
GPT fdisk (gdisk) version 0.5.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): q

答案1

这是一个大胆的猜测,但可能是您的磁盘使用了主机保护区 (HPA) 功能,该功能会“隐藏”磁盘的某些扇区。不幸的是,一些较旧的 Linux 内核会忽略 HPA。如果您使用这样的内核对磁盘进行分区,较新的内核(遵循 HPA 设置)会显示磁盘突然小于旧内核显示的大小,并且您会得到您报告的确切症状。

要检查这一点,请使用hdparm及其-N选项,如下所示:

$ sudo hdparm -N /dev/sda

/dev/sda:
 max sectors   = 488397168/488397168, HPA is disabled

在这种情况下,HPA 被禁用;但如果已启用,则输出将显示这一事实。如果这是您发现的结果,您可以使用相同的命令正确设置它,但您必须添加p和正确的大小,如下所示:

$ sudo hdparm -N p488397168

您必须根据磁盘的实际大小调整传递的值。

答案2

我的猜测是:10.4 太旧了,以至于 gpt 分区工具包含错误。

http://en.wikipedia.org/wiki/History_of_hard_disk_drives

2010 年——第一款 3.0 TB 硬盘[23][24] (希捷、西部数据)

2010 年——第一台采用 4,096 字节/块(“4K”)高级格式(而非 512 字节/块)制造的硬盘[25] 2

解决方案:

  • 获取新磁盘,
  • 使用最新的工具创建新的表和分区,
  • 将您的数据移动到新磁盘。

抱歉我没有更好的主意。

答案3

其他解决方案:

如果已知该错误,也许 Ubuntu 会在安装过程中修复分区表。

如果不是,至少服务器 10.4 还没有到达它的使用寿命的终点https://wiki.ubuntu.com/Releases

搜索或提交错误https://bugs.launchpad.net/ubuntu/

但我担心他们在生命终结之前找不到解决方案(2015 年 4 月 30 日)

无论如何,您都需要空间来创建系统备份。因此,无论您选择哪种解决方案,都可能需要一个新磁盘。

答案4

好的。感谢所有试图提供帮助的人。这似乎与 ubuntu 关系不大,基本上是一个 BIOS 错误。

一些技嘉主板在连接磁盘时会立即将其 BIOS 副本写入硬盘。因此,只需在主板上连接新的 HD,就可能会写入,并且 HPA 将被激活,从而减小磁盘的大小。Ubuntu 10.04 默认忽略 HPA(libata.ignore_hpa=1 内核参数),因此将整个磁盘视为未激活 HPA,使用磁盘的所有扇区。Ubuntu 14.04 默认尊重 HPA(libata.ignore_hpa=0 内核参数),因此将磁盘视为比实际更小。磁盘最初是从 10.04 开始按扇区总数分区的。更改电缆最终导致在 RAID 的所有磁盘上激活 HPA。我非常幸运,因为原始分区没有使用所有可用空间,但在驱动器末尾为 HPA 窃取的扇区留下了足够的空间。我不知道为什么,也许是它与倒数第二个磁柱对齐。我得出的解决办法是,重新对驱动器进行分区,使它们比实际的要小,与 HPA 设定的一样大。我启动到 14.04 并使用 gedit 修复了分区。

这个过程非常危险,可能会毁掉我的所有数据。如果你关心驱动器的内容,请不要重复此操作。

在我修复了所有三个驱动器后,两个操作系统都可以使用 raid,所以我实际上在硬盘上安装了 14.04。当我在 10.04 上启动时,分区实用程序抱怨我没有使用所有磁盘,但在更改任何内容之前会询问,因此不会造成任何损害。为了解决这个小麻烦,我在 10.04 的 /etc/default/grub.conf 的内核参数中添加了 libata.ignore_hpa=0 并更新了 grub。

仅出于历史原因,这里是我用来转换 /dev/sda 驱动器分区方案的危险过程(所有驱动器都相同):

root@ubuntu:/cdrom/HPA_recovery# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.8

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): ?
b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Command (? for help): r
Recovery/transformation command (? for help): ?
b       use backup GPT header (rebuilding main)
c       load backup partition table from disk (rebuilding main)
d       use main GPT header (rebuilding backup)
e       load main partition table from disk (rebuilding backup)
f       load MBR and build fresh GPT from it
g       convert GPT into MBR and exit
h       make hybrid MBR
i       show detailed information on a partition
l       load partition data from a backup file
m       return to main menu
o       print protective MBR data
p       print the partition table
q       quit without saving changes
t       transform BSD disklabel partition
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Recovery/transformation command (? for help): d

Recovery/transformation command (? for help): p
Disk /dev/sda: 5860531055 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2D50CD70-85F5-46FE-85B3-35A027E3C828
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 8-sector boundaries
Total free space is 5070 sectors (2.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34        73658024   35.1 GiB    EF00
   2        73722285      5860528064   2.7 TiB     FD00
   3        73658025        73722284   31.4 MiB    EF02

Recovery/transformation command (? for help): x
Expert command (? for help): ?
a       set attributes
c       change partition GUID
d       display the sector alignment value
e       relocate backup data structures to the end of the disk
g       change disk GUID
h       recompute CHS values in protective/hybrid MBR
i       show detailed information on a partition
l       set the sector alignment value
m       return to main menu
n       create a new protective MBR
o       print protective MBR data
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       resize partition table
t       transpose two partition table entries
u       Replicate partition table on new device
v       verify disk
w       write table to disk and exit
z       zap (destroy) GPT data structures and exit
?       print this menu

Expert command (? for help): e
Relocating backup data structures to the end of the disk

Expert command (? for help): ?
a       set attributes
c       change partition GUID
d       display the sector alignment value
e       relocate backup data structures to the end of the disk
g       change disk GUID
h       recompute CHS values in protective/hybrid MBR
i       show detailed information on a partition
l       set the sector alignment value
m       return to main menu
n       create a new protective MBR
o       print protective MBR data
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       resize partition table
t       transpose two partition table entries
u       Replicate partition table on new device
v       verify disk
w       write table to disk and exit
z       zap (destroy) GPT data structures and exit
?       print this menu

Expert command (? for help): v

Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.

Caution: Partition 1 doesn't begin on a 8-sector boundary. This may
result in degraded performance on some modern (2009 and later) hard disks.

Caution: Partition 2 doesn't begin on a 8-sector boundary. This may
result in degraded performance on some modern (2009 and later) hard disks.

Caution: Partition 3 doesn't begin on a 8-sector boundary. This may
result in degraded performance on some modern (2009 and later) hard disks.

Consult http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
for information on disk alignment.

Identified 1 problems!

Expert command (? for help): x
a       set attributes
c       change partition GUID
d       display the sector alignment value
e       relocate backup data structures to the end of the disk
g       change disk GUID
h       recompute CHS values in protective/hybrid MBR
i       show detailed information on a partition
l       set the sector alignment value
m       return to main menu
n       create a new protective MBR
o       print protective MBR data
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       resize partition table
t       transpose two partition table entries
u       Replicate partition table on new device
v       verify disk
w       write table to disk and exit
z       zap (destroy) GPT data structures and exit
?       print this menu

Expert command (? for help): p
Disk /dev/sda: 5860531055 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2D50CD70-85F5-46FE-85B3-35A027E3C828
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860531021
Partitions will be aligned on 8-sector boundaries
Total free space is 2957 sectors (1.4 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34        73658024   35.1 GiB    EF00
   2        73722285      5860528064   2.7 TiB     FD00
   3        73658025        73722284   31.4 MiB    EF02

Expert command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
root@ubuntu:/cdrom/HPA_recovery# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): q

再次感谢大家的帮助。

相关内容