/dev/sda
和/mnthhd_my
仅为示例说明使用fdisk并且配合目标硬盘的容量1T,我们可以轻松的找到未挂载的硬盘是/dev/sda
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 | sudo fdisk -l Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt Disk identifier: XXXXXX-C9A1-4D0D-8CF5-XXXXX Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1230847 1228800 600M EFI System /dev/nvme0n1p2 1230848 3327999 2097152 1G Linux filesystem /dev/nvme0n1p3 3328000 500117503 496789504 236.9G Linux LVM Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/mapper/cl-root: 50 GiB, 53687091200 bytes, 104857600 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 Disk /dev/mapper/cl-swap: 15.7 GiB, 16869490688 bytes, 32948224 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 Disk /dev/mapper/cl-home: 171.2 GiB, 183798595584 bytes, 358981632 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 |
---|
如果有下面的情况,可以使用lsblk
1 2 3 4 5 6 7 8 9 10 | ➜ ~ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk nvme0n1 259:0 0 238.5G 0 disk ├─nvme0n1p1 259:1 0 600M 0 part /boot/efi ├─nvme0n1p2 259:2 0 1G 0 part /boot └─nvme0n1p3 259:3 0 236.9G 0 part ├─cl-root 253:0 0 50G 0 lvm / ├─cl-swap 253:1 0 15.7G 0 lvm [SWAP] └─cl-home 253:2 0 171.2G 0 lvm /home |
---|
如上
其实就是格式化新的硬盘,这一步是比较危险的,一定要确保/dev/sda
是你那里正确的硬盘。
1 | mkfs -t ext4 /dev/sda |
---|
这一步并非必须的,但是如果需要这样的问题wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error
。则需要执行这一个步骤。
1 | sudo mkdir /mnthhd_my |
---|
其中/mnthhd_my
并没有限定,可以为其他路径。
1 | sudo mount /dev/sda mnthhd_my |
---|
1 2 3 4 5 6 7 8 9 10 | ➜ ~ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk /mnthhd_my nvme0n1 259:0 0 238.5G 0 disk ├─nvme0n1p1 259:1 0 600M 0 part /boot/efi ├─nvme0n1p2 259:2 0 1G 0 part /boot └─nvme0n1p3 259:3 0 236.9G 0 part ├─cl-root 253:0 0 50G 0 lvm / ├─cl-swap 253:1 0 15.7G 0 lvm [SWAP] └─cl-home 253:2 0 171.2G 0 lvm /home |
---|
sda对应的MOUNTPOINT的值变成了/mnthhd_my
cp /etc/fstab /etc/fstab.backup
sudo vim /etc/fstab
/dev/sda /mnthhd_my ext4 defaults 0 2
mount -a
验证fstab配置是否正确。