我在磁盘上创建了一个分区,如下所示:
root@vps-90446fc7:~# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-419430399, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-419430399, default 419430399):
Created a new partition 1 of type 'Linux' and of size 200 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
然后我检查创建的分区:
root@vps-90446fc7:~# fdisk -l
Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: QEMU HARDDISK
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: 0xfef6f988
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 419430399 419428352 200G 83 Linux
我说:Disklabel type: dos
这已经很奇怪了。
parted
说是MSDOS分区:
root@vps-90446fc7:~# parted -l
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 215GB 215GB primary
e2fsck
无法识别分区:
e2fsck -f /dev/sdb1
e2fsck 1.46.5 (30-Dec-2021)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sdb1
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
Found a dos partition table in /dev/sdb1
我不知道我做错了什么。我只想创建一个普通的Linux(什么类型都好)分区来存储文件。
答案1
您已在设备上创建了 MBR 分区表(也称为 DOS 分区表)/dev/sdb
。它包含一个标记为 Linux 分区的条目,/dev/sdb1
. “Linux”标签纯粹是提供信息,不启用或限制任何功能。
您现在需要在该分区上创建一个文件系统,例如如下所示:
mkfs.ext4 -L data /dev/sdb1
然后您可以将其安装到您的系统中。例如,这会将其安装在/mnt/dsk
:
mkdir -p /mnt/dsk
mount /dev/sdb1 /mnt/dsk
如果您记得在删除文件系统 ( umount /mnt/dsk
) 之前卸载它,则您永远不需要使用e2fsck
.当系统完全关闭时,系统会自动卸载所有文件系统,因此您无需记住自己执行此操作。