步骤如下
检测NVME硬盘
bash
cat /proc/partitions
输出
bash
major minor #blocks name
1 0 4096 ram0
1 1 4096 ram1
1 2 4096 ram2
1 3 4096 ram3
1 4 4096 ram4
1 5 4096 ram5
1 6 4096 ram6
1 7 4096 ram7
259 0 488386584 nvme0n1
179 0 15267840 mmcblk1
179 1 4096 mmcblk1p1
179 2 4096 mmcblk1p2
179 3 4096 mmcblk1p3
179 4 12288 mmcblk1p4
179 5 32768 mmcblk1p5
179 6 32768 mmcblk1p6
179 7 6553600 mmcblk1p7
179 8 8611840 mmcblk1p8
179 96 4096 mmcblk1rpmb
179 64 4096 mmcblk1boot1
179 32 4096 mmcblk1boot0
如果有 nvme0n1
就说明有 NVME SSD
硬盘。可以进行下一步。
分区
只分一个区
bash
(echo g; echo n; echo p; echo 1; echo ""; echo ""; echo w; echo q) | sudo fdisk /dev/nvme0n1
输出
bash
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x5b899dc5.
Command (m for help): Created a new GPT disklabel (GUID: 41364481-DE8B-DA4B-AF5B-3966AF3946FB).
Command (m for help): Partition number (1-128, default 1): Value out of range.
Partition number (1-128, default 1): First sector (2048-976773134, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-976773134, default 976773134):
Created a new partition 1 of type 'Linux filesystem' and of size 465.8 GiB.
Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
格式化 EXT4
bash
sudo mkfs.ext4 /dev/nvme0n1p1
输出
bash
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done
Creating filesystem with 122096385 4k blocks and 30531584 inodes
Filesystem UUID: 6b369f2f-173b-4bbf-bbf9-4668e137cbef
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: done
Writing inode tables: done
Creating journal (262144 blocks):
done
Writing superblocks and filesystem accounting information:
done
系统启动自动挂载
1. 查看BlockID
bash
sudo blkid /dev/nvme0n1p1
输出
bash
/dev/nvme0n1p1: UUID="6b369f2f-173b-4bbf-bbf9-4668e137cbef" TYPE="ext4" PARTUUID="9e55ee97-8c07-504e-beef-e7963967e9bf"
修改 fstab
bash
sudo vi /etc/fstab
UUID=6b369f2f-173b-4bbf-bbf9-4668e137cbef /media/nvme ext4 defaults 0 0
建立目录和修改权限
bash
sudo mkdir -p /media/nvme
sudo chmod 777 /media/nvme
挂载
bash
sudo mount /media/nvme
重启
bash
sudo reboot