H.R*_*hin 5 partitioning gparted
我有显示 unloacted 的笔式驱动器。我尝试了许多工具,如 gparted、fdisk、gpart、testdisk 等,但我无法使其可用。这是我的测试结果:
磁盘:
$ sudo fdisk -l
....
Disk /dev/sdc: 8010 MB, 8010194944 bytes
247 heads, 62 sectors/track, 1021 cylinders, total 15644912 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: 0xd0e2392f
Disk /dev/sdc doesn't contain a valid partition table
Run Code Online (Sandbox Code Playgroud)
因此,此设备大小正确标识为 8010MB (8GB) 并位于 /dev/sdc。有趣的是,fdisk 报告该设备没有有效的分区表。所以分区表发生了一些事情,我想在 fdisk 命令的帮助下修复它,如下所示
$sudo fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x4c9b7827. Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table
Run Code Online (Sandbox Code Playgroud)
然后我尝试对 Pendrive 进行分区
#sudo fdisk /dev/sdc
...
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Partition type: primary (0 primary, 0 extended, 4 free) extended Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15644911, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15644911, default 15644911): Using default value 15644911
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition
Run Code Online (Sandbox Code Playgroud)
完成此操作后,我的笔式驱动器仍未定位。然后我尝试使用 gparted 解决。
Gparted 结果:
我使用“gparted”工具添加了一个分区表。如上图所示,gparted 在 /dev/sdc 显示此设备,其中 Partition=unallocated 和 FileSystem=unallocated,因此它也确定存在问题。因此,我尝试添加 msdos 类型的分区表 [按设备 -> 创建分区表...],但 GUI 显示错误消息“创建分区表时出错”。命令行也有一些问题,如下所列
$sudo gparted
======================
libparted : 3.1
======================
/dev/sdc: unrecognised disk label
/dev/sdc: unrecognised disk label
Run Code Online (Sandbox Code Playgroud)
现在我该如何解决这个问题。提前致谢。
小智 1
您可以尝试通过运行以下命令将驱动器清零,如评论中所述:
# dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync
Run Code Online (Sandbox Code Playgroud)
...其中 sdx 是您要格式化的驱动器。
请务必小心,确保您在正确的驱动器上执行此操作!
然后创建一个新的分区表...
# cfdisk /dev/sdx
# mkfs.ext4 /dev/sdx1
# e2label /dev/sdx1 USB_STICK
Run Code Online (Sandbox Code Playgroud)
这与运行 gparted 相结合......
gksudo gparted
Run Code Online (Sandbox Code Playgroud)
...为我工作。我有一个 USB 记忆棒,我在上面添加了一个 ISO 来用于启动,然后在恢复它时遇到了麻烦。这些是我采取的步骤,它再次可用。