我img
通过以下命令创建了一个文件:
dd if=/dev/zero bs=2M count=200 > binary.img
它只是一个带有零的文件,但是我可以在其中使用它fdisk
并创建一个分区表:
# fdisk binary.img
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x51707f21.
Command (m for help): p
Disk binary.img: 400 MiB, 419430400 bytes, 819200 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: 0x51707f21
再说一个分区:
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-819199, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-819199, default 819199):
Created a new partition 1 of type 'Linux' and of size 399 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
当我检查分区表时,得到以下结果:
Command (m for help): p
Disk binary.img: 400 MiB, 419430400 bytes, 819200 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: 0x7f3a8a6a
Device Boot Start End Sectors Size Id Type
binary.img1 2048 819199 817152 399M 83 Linux
因此该分区存在。当我尝试通过gparted格式化该分区时,出现以下错误:
我不知道为什么会寻找binary.img1
,而且我也不知道如何从命令实时格式化分区。
有谁知道如何使用ext4文件系统格式化它?
Couldn't find valid filesystem superblock.
。这是图片:i.imgur.com/dl7XAC4.png。这是某种错误吗?