sudo fdisk -l /dev/sda

sudo fdisk -l /dev/sda

由 Ubuntu 14.04 LTS 安装程序安装:

我已经在笔记本电脑上安装了 Ubuntu 14.04 LTS 桌面,但由于我想通过台式电脑访问笔记本文件,因此我做出了一个错误的决定,即从根驱动器更改文件所有权和权限。

结果是现在我无法访问我的磁盘。我的笔记本有两个硬盘,一个闪存启动闪存驱动器足以容纳系统,另一个硬盘用于存储,我将其分成两个分区,/Home 和 /Var。

以下是带有磁盘信息输出的命令参考:

sudo fdisk -l /dev/sda

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

    Device  Boot      Start          End      Blocks    Id   System
 /dev/sda1   ?      6579571   1924427647  968924038+    70   DiskSecure Multi-Boot
 Partition 1 does not start on physical sector boundary.
 /dev/sda2   ?   1953251627   3771827541  909287957+    43   Unknown
 Partition 2 does not start on physical sector boundary.
 /dev/sda3   ?    225735265    225735274          5     72   Unknown
 Partition 3 does not start on physical sector boundary.
 /dev/sda4   ?   2642411520   2642463490      25945      0   Empty

 Partition table entries are not in disk order

sudo cryptsetup -v luksDump /dev/sda1

 Device /dev/sda1 is not a valid LUKS device.
 Command failed with code 22:  Device /dev/sda1 is not a valid LUKS device.

sudo cryptsetup -v luksDump /dev/sda2

 Device /dev/sda1 is not a valid LUKS device.
 Command failed with code 22:  Device /dev/sda2 is not a valid LUKS device.

似乎还有 /dev/sda3 和 /dev/sda4,但这些分区什么都不包含,/sda3 有 5 个块,/sda4 有 25945 个块是空的。这一切都是通过 Ubuntu 14.04 LTS 桌面安装完成的。

第 1 节 命令输出

sudo gdisk -l /dev/sda

 GPT fdisk (gdisk) version 0.8.8 

 Caution: invalid main GPT header, but valid backup; regenerating main header
 from backup! 

 Caution! After loading partitions, the CRC doesn't check out! 
 Warning! Main partition table CRC mismatch! Loaded backup partition table 
 instead of main partition table! 

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

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

 Found valid MBR and corrupt GPT. Which do you want to use? (Using the
 GPT MAY permit recovery of GPT data.) 
 1 - MBR
 2 - GPT
 3 - Create blank GPT

 Your answer: 2

 Disk /dev/sda:  1953525168 sectors, 931.5 GiB
 Logical sector size  512 bytes
 Disk identifier  (GUID):  37C12505-96AB-4193-AD2F-A86ECEE7A8F9
 Partition table holds up to 128 entries
 First usable sector is 34, last uable sector is 1953525134
 Partitions will be aligned on 2048-sector boundaries
 Total free space is 3437 sectors (1.7 MiB)

 Number   Start (sector)   End (sector)  Size      Code   Name
   1              2048     1054685183   502.9 GiB  8300
   2        1054685184     1953523711   428.6 GiB  8300

第 2 节 命令输出

sudo lsblk

 NAME    MAJ:MIN  RM      SIZE   RO   TYPE  MOUNTPOINT
 sda       8:0     0    931.5G    0   disk
 |-sda1    8:1     0    811.6G    0   part
 |-sda2    8:2     0    346.1G    0   part
 sdb       8:16    0     22.4G    0   disk
 |-sdb1    8:17    0      512M    0   part  /boot/efi
 |-sdb2    8:18    0       14G    0   part  /
 |-sdb3    8:19    0      7.8G    0   part  [SWAP] 

sudo parted -l

 Model:  ATA WDC  WD10JPVT-08A (scsi)
 Disk /dev/sda: 1000GB
 Sector size (logical/physical): 412B/4096B
 Partition Table: loop

 Number    Start    End      Size    File system   Flags
  1         0.00B   1000GB   1000GB  ntfs

 Model: ATA LITEONIT  LSS-24L (scsi)
 Disk /dev/sdb: 24.0GB
 Sector size (logical/physical):  512B/512B
 Partition Table: gpt

 Number    Start    End      Size    File system  Name  Flags
  1        1049kB   538MB    537MB   fat32              boot
  2        538MB    15.6GB   15.1GB  ext4 
  3        15.6GB   8398MB   linux-swap(v1)

 Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
 has been opened read-only.
 Error: /dev/sr0: unrecognised disk label

sudo fdisk -l /dev/sda

 Disk /dev/sda: 1000.2 gb, 1000204886016 bytes
 255 heads, 63 sectors/tracks, 121601 cylinders, total 1953525168 sectors
 Units = sectors of 1 * 512 bytes
 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 Disk identifier: 0x2052474d

 This doesn't look like a partition table
 Probably you selected the wrong device.

    Device  Boot      Start          End      Blocks    Id   System
 /dev/sda1   ?      6579571   1924427647  968924038+    70   DiskSecure Multi-Boot
 Partition 1 does not start on physical sector boundary.
 /dev/sda2   ?   1953251627   3771827541  909287957+    43   Unknown
 Partition 2 does not start on physical sector boundary.
 /dev/sda3   ?    225735265    225735274          5     72   Unknown
 Partition 3 does not start on physical sector boundary.
 /dev/sda4   ?   2642411520   2642463490      25945      0   Empty

*在这种情况下,(/dev/sdb) 是我的系统启动驱动器,而 (/dev/sda) 是我尝试重新挂载的存储硬盘驱动器,并且它已被 Ubuntu 14.04 LTS 安装程序设置为“DiskSecure Multi-Boot”。

现在,为什么“#lsblk”显示不同的大小(甚至大于磁盘驱动器的最大大小)?

我的启动硬盘 (/dev/sdb) 已使用 GPT 设置为启动驱动器。我还需要在我的非启动硬盘上设置 GPT 分区吗?

此外,如果“#parted -l”只能看到一个以 ntfs 形式跨越整个驱动器的分区,我该如何安装具有两个分区的存储驱动器?

第 3 节 命令输出

sudo blkid /dev/sda

 /dev/sda: UUID="58DEF9CB30F761D5" TYPE="ntfs"

答案1

根据 的输出,您的 GPT 分区表已损坏gdisk。请使用以下命令将您的分区表备份到正常工作的驱动器上的文件中:

sudo sgdisk --backup=/path/to/backup.sgdisk /dev/sda

您需要将其存储在您有写入权限的地方,例如 USB 驱动器或主文件夹。如果您使用的是实时系统,您还应该将备份永久存储在另一个内部或外部驱动器上,因为实时系统通常会在关机时丢失所有更改。

然后,您可以放心地继续gdisk使用 的问题中的选项 2,即使用哪个分区表。它可能会恢复 GPT 备份并使一切恢复正常。然后,您可以尝试解决权限问题。

相关内容