如何修复“分区未从物理扇区边界开始”的警告?

我在我的笔记本电脑上有一个硬盘驱动器,分为两个分区(一个ext3分区安装了Ubuntu 12.04,另一个是交换分区)。
fdisk 给出了以下警告:
Partition 1 does not start on physical sector boundary

什么是原因,我需要修复吗?如果需要,怎么办?
这是sudo fdisk -l的输出:
Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 testine, 63 settori/tracce, 91201 cilindri, totale 1465149168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Identificativo disco: 0x5a25087f

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63  1448577023   724288480+  83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sda2      1448577024  1465147391     8285184   82  Linux swap / Solaris

这是与sudo lshw相关的结果:
 *-disk
                description: ATA Disk
                product: WDC WD7500BPKT-0
                vendor: Western Digital
                physical id: 0
                bus info: scsi@0:0.0.0
                logical name: /dev/sda
                version: 01.0
                serial: WD-WX21CC1T0847
                size: 698GiB (750GB)
                capabilities: partitioned partitioned:dos
                configuration: ansiversion=5 signature=5a25087f
              *-volume:0
                   description: EXT3 volume
                   vendor: Linux
                   physical id: 1
                   bus info: scsi@0:0.0.0,1
                   logical name: /dev/sda1
                   logical name: /
                   version: 1.0
                   serial: cc5c562a-bc59-4a37-b589-805b27b2cbd7
                   size: 690GiB
                   capacity: 690GiB
                   capabilities: primary bootable journaled extended_attributes large_files recover ext3 ext2 initialized
                   configuration: created=2010-02-27 09:18:28 filesystem=ext3 modified=2012-06-23 18:33:59 mount.fstype=ext3 mount.options=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered mounted=2012-06-28 00:20:47 state=mounted
              *-volume:1
                   description: Linux swap volume
                   physical id: 2
                   bus info: scsi@0:0.0.0,2
                   logical name: /dev/sda2
                   version: 1
                   serial: 16a7fee0-be9e-4e34-9dc3-28f4eeb61bf6
                   size: 8091MiB
                   capacity: 8091MiB
                   capabilities: primary nofs swap initialized
                   configuration: filesystem=swap pagesize=4096

这些是相关的/etc/fstab行:
UUID=cc5c562a-bc59-4a37-b589-805b27b2cbd7 /               ext3    errors=remount-ro,user_xattr 0       1
UUID=16a7fee0-be9e-4e34-9dc3-28f4eeb61bf6 none            swap    sw              0       0
9个回答

您的硬盘采用了高级格式4096字节扇区,分区未完全对齐

以下是对警告的解释:

扇区大小(逻辑/物理):512字节 / 4096字节
  • 您的硬盘是较新型号之一,采用每个物理扇区4096字节的高级格式,而不是旧的512字节/扇区。
  • 这些硬盘仍然可以提供512字节/扇区的“传统”模拟,这就是为什么您看到逻辑扇区大小为512的原因。
  • 实际上,lshw显示它是一款西部数据硬盘,这是第一家转向高级格式的公司。他们有一个包含大量信息的详细页面,您可能希望查看一下。
因此,警告出现是因为分区1从逻辑扇区63 = 字节32256开始,这个数字不能被4096整除;实际上它接近第7个物理扇区的末尾(确切地说是第7.875个位置 :))。
你应该修复它吗?如果是的话,怎么做?[一定要备份!]
理论上,这种分区方式可能会对读/写IO速率产生一定影响,这取决于你的驱动器固件。如果你现在对性能满意,可以忽略警告,不需要做任何操作。如果不满意,请先备份所有重要数据,然后使用Gparted将分区移动到以4096字节扇区开始;将起始边界设置为1 MiB是一种简单的方法。
技术上讲,你可以将起始位置设置为任何逻辑扇区,它必须是8的倍数,例如64是好的,256也是好的,等等,但63、255等则不行。

1这个回答暗示可能不是一个问题:https://askubuntu.com/a/880152/297529 - markling
不过如果是扩展分区的话,这并不是问题,因为我无法想象第一个分区会是扩展分区。通常情况下是3个分区。 - mckenzm

对于您的新硬盘驱动器,首先使用gparted按照您的意愿创建分区。
然后,使用sudo fdisk device_name访问您的硬盘驱动器。 在fdisk中使用m命令将打印帮助菜单。
npcompete@npcompete-desktop:~$ sudo fdisk /dev/sda
设备的逻辑扇区大小小于物理扇区大小。建议对齐到物理扇区(或最佳I/O)大小边界,否则可能会影响性能。
命令(输入 m 查看帮助):p 磁盘 /dev/sda:1000.2 GB,1000204886016 字节 255 个磁头,63 个扇区/磁道,121601 个柱面,共 1953525168 个扇区 单位 = 每个扇区 1 * 512 = 512 字节 扇区大小(逻辑/物理):512 字节 / 4096 字节 I/O 大小(最小/最佳):4096 字节 / 4096 字节 磁盘标识符:0x0008e009
设备 引导 起始位置 结束位置 块数 Id 系统 /dev/sda1 2048 209717247 104857600 83 Linux /dev/sda2 209717248 1953525167 871903960 5 Extended /dev/sda5 600349113 795667319 97659103+ 83 Linux 第 5 个分区不以物理扇区边界开始。 /dev/sda6 795667383 990985589 97659103+ 83 Linux 第 6 个分区不以物理扇区边界开始。 /dev/sda7 990985653 1953520064 481267206 83 Linux 第 7 个分区不以物理扇区边界开始。 /dev/sda8 209719296 600349112 195314908+ 83 Linux
分区表条目未按照磁盘顺序排列 命令(输入 m 查看帮助):d 分区号(1-8):5
命令(输入 m 查看帮助):p 磁盘 /dev/sda:1000.2 GB,1000204886016 字节 255 个磁头,63 个扇区/磁道,121601 个柱面,共 1953525168 个扇区 单位 = 每个扇区 1 * 512 = 512 字节 扇区大小(逻辑/物理):512 字节 / 4096 字节 I/O 大小(最小/最佳):4096 字节 / 4096 字节 磁盘标识符:0x0008e009
设备 引导 起始位置 结束位置 块数 Id 系统 /dev/sda1 2048 209717247 104857600 83 Linux /dev/sda2 209717248 1953525167 871903960 5 Extended /dev/sda5 795667383 990985589 97659103+ 83 Linux 第 5 个分区不以物理扇区边界开始。 /dev/sda6 990985653 1953520064 481267206 83 Linux 第 6 个分区不以物理扇区边界开始。 /dev/sda7 209719296 600349112 195314908+ 83 Linux
分区表条目未按照磁盘顺序排列
命令(输入 m 查看帮助):w 分区表已更改!
调用ioctl()重新读取分区表。 正在同步磁盘。 npcompete@npcompete-desktop:~$ sudo fdisk /dev/sda
设备的逻辑扇区大小小于物理扇区大小。建议对齐到物理扇区(或最
现在使用fdisk中的-d选项删除给出警告的分区。
首先是命令-d,然后是分区号(在警告中提到)。
现在使用-w命令将更改写入磁盘。它将退出fdisk。
第二次使用sudo fdisk <设备名称>访问您的硬盘驱动器。
现在使用fdisk中的-n命令使用空闲空间(之前我们已经删除了一个分区,那将是空闲空间或未分配空间)创建一个新的分区。
在新分区命令中,不要为第一个和最后一个扇区输入任何值,只需按Enter键。它将采用默认值。
现在使用-w命令将更改写入磁盘。它将退出fdisk。
对所有分区执行上述步骤。完成后,使用gparted格式化您新创建的分区。(这就是我所做的,对于我来说,在fdisk -l输出中没有警告。)

正如izx所指出的:

您的硬盘具有4096字节扇区的高级格式,而分区与之不完全对齐。

本文很好地解释了高级格式规范及其对用户硬盘分区实践的影响。
要解决此问题,您必须备份数据,然后执行以下操作:
  1. 调整错误大小的分区至正确大小;
  2. 或者删除错误大小的分区并创建一个正确大小的新分区。
要使用名为GParted的图形化硬盘分区软件完成此操作,您可以:
  1. 以超级用户权限启动Gparted应用程序;请小心

    gksudo gparted
    
  2. 从GParted菜单右上角的下拉菜单中选择包含错误大小分区的存储设备。

  3. 通过在矩形分区图中点击它来选择错误大小的分区。

  4. 现在,您可以选择删除并创建新的分区,或者选择调整现有分区的大小。无论您的选择如何,都将进入一个菜单,允许您设置分区的大小。您必须清除“舍入到柱面”复选框,并将前面的空闲空间大小设置为1MiB。它会类似于:

GParted - Create new partition.


通过切换“u”单位。创建分区时,默认的扇区大小将显示出来。 如果您开始对新磁盘进行分区并遇到此错误,您可以:
  1. 使用默认设置创建一个分区。
  2. n,p,1,Enter, Enter
  3. 显示并获取分区错误信息。“p”。
  4. 切换单位“u”
  5. 删除分区。“d”
  6. 现在重新创建。这次默认值将显示正确的扇区。(在我的情况下是1024)。

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-72937, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-72937, default 72937):
Using default value 72937

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       72937   585866421   83  Linux
Partition 1 does not start on physical sector boundary.

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63  1171732904   585866421   83  Linux
Partition 1 does not start on physical sector boundary.

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 8
Value out of range.
Partition number (1-4): 1
First sector (63-1171743835, default 1024):
Using default value 1024
Last sector, +sectors or +size{K,M,G} (1024-1171743835, default 1171743835):
Using default value 1171743835

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            1024  1171743835   585871406   83  Linux

Command (m for help): w
The partition table has been altered!

1我尝试了其他答案中的方法,但只有切换到'u'模式对我有效。 - JosephH
1在所有的答案中,这个也是对我有效的一个。 - Avanst

1. 解决方法

我也遇到了这个问题,下面是我如何解决这个烦人的警告!

关键点是:将起始扇区设置为任何逻辑扇区,该扇区是8的倍数

我设置为204800(因为我只能选择65535-976773167之间的数字)。

步骤1:fdisk

$ fdisk /dev/sdf

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。


命令(输入 m 获取帮助):d
已选择分区 1
分区 1 已删除

命令(输入 m 获取帮助):p

磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70

   设备 Boot      Start         End      Blocks   Id  System

命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):1

# the key point
# ⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬
起始 扇区 (65535-976773167,默认为 65535):  204800 (chose a multiple of 8)
Last 扇区, +扇区 or +size{K,M,G} (204800-976773167,默认为 976773167):
将使用默认值 976773167
分区 1 已设置为 Linux 类型,大小设为 465.7 GiB
# 




命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。

步骤2 格式化磁盘

$ mkfs.ext4 /dev/sdf1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=8191 blocks
30523392 inodes, 122071046 blocks
6103552 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2271215616
3726 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
  4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
  102400000

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

第三步 结果

最后,警告已消失。

$ fdisk -l /dev/sdf

磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdf1          204800   976773167   488284184   83  Linux



$ lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 223.6G  0 disk
├─sda1                 8:1    0   500M  0 part /boot/efi
├─sda2                 8:2    0     1G  0 part /boot
└─sda3                 8:3    0   170G  0 part
  ├─centos--sda-root 253:0    0   100G  0 lvm  /
  ├─centos--sda-swap 253:1    0    20G  0 lvm
  └─centos--sda-home 253:2    0    50G  0 lvm  /home
sdb                    8:16   0   1.8T  0 disk /data2
sdc                    8:32   0   1.8T  0 disk
sdd                    8:48   0   1.8T  0 disk /data1
sde                    8:64   0   1.8T  0 disk /home
sdf                    8:80   0 465.8G  0 disk
└─sdf1                 8:81   0 465.7G  0 part

2. 这个问题的表现形式如何
显示磁盘
[root@dt120 data1]# lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 223.6G  0 disk
├─sda1                 8:1    0   500M  0 part /boot/efi
├─sda2                 8:2    0     1G  0 part /boot
└─sda3                 8:3    0   170G  0 part
  ├─centos--sda-root 253:0    0   100G  0 lvm  /
  ├─centos--sda-swap 253:1    0    20G  0 lvm
  └─centos--sda-home 253:2    0    50G  0 lvm  /home
sdb                    8:16   0   1.8T  0 disk /data2
sdc                    8:32   0   1.8T  0 disk
sdd                    8:48   0   1.8T  0 disk /data1
sde                    8:64   0   1.8T  0 disk /home
sdf                    8:80   0 465.8G  0 disk
└─sdf1                 8:81   0 465.7G  0 part


fdisk
$ fdisk /dev/sdf
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xff020bf0 创建新的 DOS 磁盘标签。

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

命令(输入 m 获取帮助):p

磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xff020bf0

   设备 Boot      Start         End      Blocks   Id  System


命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (65535-976773167,默认为 65535):
将使用默认值 65535
Last 扇区, +扇区 or +size{K,M,G} (65535-976773167,默认为 976773167):
将使用默认值 976773167
分区 1 已设置为 Linux 类型,大小设为 465.7 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0x2b6ce6ea

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdf1           65535   976773167   488353816+  83  Linux
Partition 1 does not start on physical sector boundary.

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。


$ lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 223.6G  0 disk
├─sda1                 8:1    0   500M  0 part /boot/efi
├─sda2                 8:2    0     1G  0 part /boot
└─sda3                 8:3    0   170G  0 part
  ├─centos--sda-root 253:0    0   100G  0 lvm  /
  ├─centos--sda-swap 253:1    0    20G  0 lvm
  └─centos--sda-home 253:2    0    50G  0 lvm  /home
sdb                    8:16   0   1.8T  0 disk /data2
sdc                    8:32   0   1.8T  0 disk
sdd                    8:48   0   1.8T  0 disk /data1
sde                    8:64   0   1.8T  0 disk /home
sdf                    8:80   0 465.8G  0 disk
└─sdf1                 8:81   0 465.7G  0 part

格式
$ mkfs.ext4 /dev/sdf1
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdf1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=8191 blocks
30523392 inodes, 122088454 blocks
6104422 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2271215616
3726 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
  4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
  102400000

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

问题
分区1不以物理扇区边界开始。
$ fdisk -l /dev/sdf

磁盘 /dev/sdf:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 33553920 字节
磁盘标签类型:dos
磁盘标识符:0xa2254a70

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdf1           65535   976773167   488353816+  83  Linux
Partition 1 does not start on physical sector boundary.

只需删除所有分区,并使用fdisk执行以下操作:
Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

我在这个帖子中用一个例子来完善其他出色的答案,展示了如何通过数字方式修复警告。
我可以通过一个活动的USB驱动器完成所有这些操作: 它提供终端、计算器和当然还有GParted。 问题是要调整分区的起始边界。

给定条件

对于我的情况,sudo fdisk -l指出了一些重要的事项:

  • 有问题的分区从扇区12001278开始;
  • 扇区大小(逻辑/物理): 512字节 / 4096字节
  • 其显示单位:单位:1 * 512字节的扇区 = 512字节

要求

警告背后的要求

Partition X does not start on physical sector boundary

分区边界应该位于逻辑扇区(每个大小为512字节)和物理扇区(每个大小为4096字节)的开头。因此,在有问题的分区之前的磁盘空间字节数必须满足以下条件

n_L * 512 = n_P * 4096

在这里,n_L是逻辑扇区计数(fdisk的输出),n_P是物理扇区计数。两个计数都必须是整数。由于4096/512=8,这就解释了为什么8必须是n_L的整数除数。

行动

在我的情况下:12001278/8 = 1500159.75,所以小数破坏了计划。 然后我可以选择将分区的起始位置向左移动(使其变大)或向右移动(使其变小)。选择取决于当前分区表中对您方便的情况。无论哪种方式,Gparted都会要求您使用MiB作为单位来移动分区。 因此,需要计算位移。

我选择将分区的起始位置向左移动,并向下舍入比率1500159.75:

要获得 n_L/8 = 1500159,你需要 n_L = 12001272。与12001278进行比较,所以将分区的起始位置向左移动6个逻辑扇区。
由于每个逻辑扇区是512字节,我要求GParted将分区的起始位置向当前位置之前移动3 MiB。您可能需要通过缩小相邻分区来为此腾出空间。
在这个3 MiB的位移之后,警告消失了。当然: 12001272 * 512 = 4096 * 1500159

如果你有一个Windows双启动系统,你可以使用MiniTool分区向导。这个工具在多次救了我的命。只需右键点击分区,然后选择对齐。别忘了点击应用。

这将清除您的磁盘!请自行承担风险。
运行以下步骤:
1. 输入命令sudo fdisk -l。 2. 获取外部硬盘的名称,通常为/dev/sdcX,其中X代表一个数字。 3. 输入命令sudo mkfs.ext4 /dev/sdcX。 4. 输入命令sudo mkdir /mnt/externalhdd,创建一个用于挂载磁盘的目录。 5. 输入命令sudo mount /dev/sdcX /mnt/externalhdd,挂载硬盘。 其他步骤:
1. 根据您的偏好更改/mnt/externalhdd的权限。
希望能对某天有所帮助!