无法挂载硬盘并担心分区设置

无法挂载硬盘并担心分区设置

最终编辑 感谢您的评论,我确实学到了很多东西。不幸的是,在决定退回硬盘后,他们自己进行了测试,得出的结论是该设备有故障。

我最近购买了一个内置 4TB 硬盘来添加到 Ubuntu 机器上。这是我第一次尝试将硬盘添加到已建立的计算机并将其安装到特定位置。不幸的是,我遇到了一些问题,我见过的所有类似帖子都没有完全解决我的问题。因此,我将尝试完整地分解我理解、遵循的步骤以及我面临的错误。

我的Ubuntu版本:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

首先,在向 HDD 添加分区并安装 HDD 的多次尝试失败后,我已经杀死了该表,因此请将此视为我的基准:

sudo dd if=/dev/zero of=/dev/sdc bs=1M count=10

磁盘是/dev/sdc

当我使用 lsblk 时,这是输出(sdc 位于底部):

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  55.5M  1 loop /snap/core18/2074
loop1    7:1    0     4K  1 loop /snap/bare/5
loop2    7:2    0  55.4M  1 loop /snap/core18/2128
loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66
loop4    7:4    0   219M  1 loop /snap/gnome-3-34-1804/72
loop5    7:5    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop6    7:6    0  65.2M  1 loop /snap/gtk-common-themes/1519
loop7    7:7    0    51M  1 loop /snap/snap-store/542
loop8    7:8    0    51M  1 loop /snap/snap-store/547
loop9    7:9    0  32.3M  1 loop /snap/snapd/13170
loop10   7:10   0  32.4M  1 loop /snap/snapd/13270
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0 465.3G  0 part /
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   116M  0 part 
├─sdb2   8:18   0   506M  0 part 
└─sdb3   8:19   0 930.9G  0 part 
sdc      8:32   0   3.7T  0 disk 
sr0     11:0    1  1024M  0 from 

并使用 sudo fdisk -l

Disk /dev/sdc: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: TOSHIBA MG03ACA4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

然后我使用 gdisk (我已尝试使用parted)来分配带有类型和名称等的分区表。

添加新分区:

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-7814037134, default = 2048) or {+-}size{KMGTP}: 2048
Last sector (2048-7814037134, default = 7814037134) or {+-}size{KMGTP}: 7814037134
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

让我们看一下p(打印)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      7814037134   3.6 TiB     8300  Linux filesystem

我想称它为商店:

Command (? for help): c store
Using 1
Enter name: store

(打印后)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      7814037134   3.6 TiB     8300  store

最后将分区表写入磁盘并退出(使用w):

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.

让我们再次查看驱动器和挂载点 ( lsblk):

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  55.5M  1 loop /snap/core18/2074
loop1    7:1    0     4K  1 loop /snap/bare/5
loop2    7:2    0  55.4M  1 loop /snap/core18/2128
loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66
loop4    7:4    0   219M  1 loop /snap/gnome-3-34-1804/72
loop5    7:5    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop6    7:6    0  65.2M  1 loop /snap/gtk-common-themes/1519
loop7    7:7    0    51M  1 loop /snap/snap-store/542
loop8    7:8    0    51M  1 loop /snap/snap-store/547
loop9    7:9    0  32.3M  1 loop /snap/snapd/13170
loop10   7:10   0  32.4M  1 loop /snap/snapd/13270
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0 465.3G  0 part /
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   116M  0 part 
├─sdb2   8:18   0   506M  0 part 
└─sdb3   8:19   0 930.9G  0 part 
sdc      8:32   0   3.7T  0 disk 
└─sdc1   8:33   0   3.7T  0 part 
sr0     11:0    1  1024M  0 rom  

我现在想将驱动器安装到名为 /store 的位置(是的,与 sdc1 上的分区同名 - 我希望这不会造成混淆)。这是我遇到错误的地方:

(base) anthony@Shodan:/dev$ sudo mount -o rw /dev/sdc1 /store
mount: /store: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.

我真的不知道从这里该做什么。我重复了上面相同的过程,但使用了parted。这些步骤是成功的,但当我尝试安装时又失败了。

编辑#1 感谢您的评论。事实证明我没有创建文件系统,所以我执行了以下命令但出现了错误:

(base) anthony@Shodan:~$ sudo mkfs.ext4 /dev/sdc1
[sudo] password for anthony: 
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 976754385 4k blocks and 244195328 inodes
Filesystem UUID: d6b2219f-b4fe-490b-bf21-513fec50c625
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: mkfs.ext4: Input/output error while writing out and closing file system

然后我安装了 smartmodtools 并使用 smartctl 来测试新驱动器,但我遇到了进一步的问题:

(base) anthony@Shodan:~$ sudo smartctl --smart=on -T permissive /dev/sdc
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.11.0-37-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Short INQUIRY response, skip product id
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
unable to fetch IEC (SMART) mode page [scsi response fails sanity test]
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

编辑#2 我仍在努力让这种动力发挥作用。磁盘支持SMART(刚刚检查BIOS),这是内核看到的:

(base) anthony@Shodan:/$ dmesg | egrep -i "sdc"
[    1.696642] sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[    1.696658] sd 2:0:0:0: [sdc] Write Protect is off
[    1.696661] sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[    1.696680] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.930394]  sdc: sdc1
[    1.943940] sd 2:0:0:0: [sdc] Attached SCSI disk
[ 2857.111158] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=90s
[ 2857.111168] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 35 c0 08 00 00 00 00 08 00 00
[ 2857.111172] blk_update_request: I/O error, dev sdc, sector 901777408 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111184] Buffer I/O error on dev sdc1, logical block 901775360, lost async page write
[ 2857.111191] Buffer I/O error on dev sdc1, logical block 901775361, lost async page write
[ 2857.111199] Buffer I/O error on dev sdc1, logical block 901775362, lost async page write
[ 2857.111204] Buffer I/O error on dev sdc1, logical block 901775363, lost async page write
[ 2857.111208] Buffer I/O error on dev sdc1, logical block 901775364, lost async page write
[ 2857.111212] Buffer I/O error on dev sdc1, logical block 901775365, lost async page write
[ 2857.111215] Buffer I/O error on dev sdc1, logical block 901775366, lost async page write
[ 2857.111223] Buffer I/O error on dev sdc1, logical block 901775367, lost async page write
[ 2857.111365] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111370] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 00 08 00 00 00 00 08 00 00
[ 2857.111371] blk_update_request: I/O error, dev sdc, sector 905971712 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111375] Buffer I/O error on dev sdc1, logical block 905969664, lost async page write
[ 2857.111378] Buffer I/O error on dev sdc1, logical block 905969665, lost async page write
[ 2857.111407] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111410] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 40 08 00 00 00 00 08 00 00
[ 2857.111410] blk_update_request: I/O error, dev sdc, sector 910166016 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111430] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111432] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 80 08 00 00 00 00 08 00 00
[ 2857.111433] blk_update_request: I/O error, dev sdc, sector 914360320 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111451] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111453] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 36 c0 08 00 00 00 00 08 00 00
[ 2857.111454] blk_update_request: I/O error, dev sdc, sector 918554624 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111471] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111473] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 00 08 00 00 00 00 08 00 00
[ 2857.111474] blk_update_request: I/O error, dev sdc, sector 922748928 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0
[ 2857.111484] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111486] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 40 08 00 00 00 00 08 00 00
[ 2857.111487] blk_update_request: I/O error, dev sdc, sector 926943232 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0
[ 2857.111517] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111520] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 80 08 00 00 00 00 08 00 00
[ 2857.111521] blk_update_request: I/O error, dev sdc, sector 931137536 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0
[ 2857.111539] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111541] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 37 c0 08 00 00 00 00 08 00 00
[ 2857.111542] blk_update_request: I/O error, dev sdc, sector 935331840 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0
[ 2857.111567] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 2857.111569] sd 2:0:0:0: [sdc] tag#0 CDB: Write(16) 8a 00 00 00 00 00 38 00 08 00 00 00 00 08 00 00
[ 2857.111570] blk_update_request: I/O error, dev sdc, sector 939526144 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0
[ 3053.218272] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3053.218285] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 3638.943105] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3638.943112] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 3653.216166] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3653.216179] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 3971.568186] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3971.568192] sd 2:0:0:0: [sdc] tag#0 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[ 3971.568197] blk_update_request: I/O error, dev sdc, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 0 prio class 0
[ 3971.568235] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3971.568237] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00
[ 3971.568238] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
[ 3971.568256] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3971.568258] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00
[ 3971.568259] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 3971.568262] Buffer I/O error on dev sdc, logical block 0, async page read
[ 3971.568276] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 3971.568278] sd 2:0:0:0: [sdc] tag#0 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00
[ 3971.568279] blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 3971.568281] Buffer I/O error on dev sdc, logical block 0, async page read
[ 3971.569093] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 3971.569103] sd 2:0:0:0: [sdc] Sense not available.
[ 3971.569160] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 3971.569164] sd 2:0:0:0: [sdc] Sense not available.
[ 3971.569203] sd 2:0:0:0: [sdc] 0 512-byte logical blocks: (0 B/0 B)
[ 3971.569280] sdc: detected capacity change from 7814037168 to 0
[ 4048.513170] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 4048.513175] sd 2:0:0:0: [sdc] Sense not available.
[ 4048.513197] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 4048.513198] sd 2:0:0:0: [sdc] Sense not available.
[ 4053.558167] sd 2:0:0:0: [sdc] Read Capacity(16) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 4053.558170] sd 2:0:0:0: [sdc] Sense not available.
[ 4053.558188] sd 2:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[ 4053.558189] sd 2:0:0:0: [sdc] Sense not available.
[ 4253.213080] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 4253.213094] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 4853.209760] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK cmd_age=0s
[ 4853.209774] sd 2:0:0:0: [sdc] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00

答案1

你没有创建一个文件系统在分区上,您需要一个才能安装它。你可能想要外部4(大多数发行版的默认设置,如果您使用 Windows 双引导,NTFS 将是更好的选择)因此只需运行mkfs.ext4 /dev/sdc1,然后就可以挂载sdc1.

相关内容