使用 parted 将外部硬盘格式化为 ext4 后它消失了,如何安装它?

使用 parted 将外部硬盘格式化为 ext4 后它消失了,如何安装它?

我有一个“我的护照”外部硬盘,我想将其格式化为 EXT4 以用于 Linux Ubuntu 22.04。

该驱动器几乎是空的,但默认情况下有几个我不介意保留的文件,因此我尝试创建一个从大约 1GB 到磁盘末尾的分区。运行格式化后,我的磁盘不再出现在我的驱动器中/media/username/。我如何cd进入该磁盘,以及如何检查它是否已正确格式化为 ext4?

我尝试遵循这一点:格式化存储驱动器的终端方法

不幸的是,创建分区导致了一些错误:

$ sudo parted /dev/sda1 mklabel gpt 
Warning: Partition(s) on /dev/sda1 are being used.
Ignore/Cancel? Ignore                                                     
Warning: The existing disk label on /dev/sda1 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes                                                               
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore                                                     
Information: You may need to update /etc/fstab.

它抱怨磁盘正在使用中,但我认为我没有对磁盘进行任何操作。我没有打开文件,也没有进入磁盘,所以我忽略了警告。

然后我尝试格式化磁盘并尝试对齐块:

$ sudo parted --align optimal /dev/sda1 -- mkpart primary ext4 1902592s -1s
Warning: You requested a partition from 974MB to 5001GB (sectors 1902592..9767471103).
The closest location we can manage is 974MB to 5001GB (sectors 1902592..9767471070).
Is this still acceptable to you?
Yes/No? Yes                                                               
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel?

由于它是外置硬盘,我不明白为什么必须重新启动,所以我只是卸载了磁盘。当我重新安装它时,它不再出现。

$ cd /media/username
$ ls
$

有人知道如何安装磁盘、如何在必要时修复格式以及如何处理这些错误消息吗?

相关内容