nvme磁盘格式化及管理
1)查看磁盘
2)格式化
root@ubuntu:/# parted /dev/nvme0n1
GNU Parted 3.3
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: INTEL SSDPF2KX076T1 (nvme)
Disk /dev/nvme0n1: 7682GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 7000GB 7000GB xfs primary
(parted) mklabel gpt
Warning: Partition(s) on /dev/nvme0n1 are being used.
Ignore/Cancel? ignore
Warning: The existing disk label on /dev/nvme0n1 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Error: Partition(s) 1 on /dev/nvme0n1 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
(parted) mkpart primary ext4 0% 100%
(parted) quit
Information: You may need to update /etc/fstab.
root@ubuntu:/# mkfs.ext4 /dev/nvme0n1p1
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 1875366144 4k blocks and 234422272 inodes
Filesystem UUID: bb9ca09a-c2f8-44b6-85ee-139e7925cb49
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: done
3)挂载
cat /etc/fstab
/dev/nvme0n1p1 /data xfs defaults 0 1
root@ubuntu:/# mount /dev/nvme0n1p1 /data
4)安装nvme管理工具
apt install nvme-cli
root@ubuntu:/# apt install nvme-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nvme-cli
0 upgraded, 1 newly installed, 0 to remove and 166 not upgraded.
Need to get 283 kB of archives.
After this operation, 687 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 nvme-cli amd64 1.9-1ubuntu0.1 [283 kB]
Fetched 283 kB in 7s (42.2 kB/s)
Selecting previously unselected package nvme-cli.
(Reading database ... 76671 files and directories currently installed.)
Preparing to unpack .../nvme-cli_1.9-1ubuntu0.1_amd64.deb ...
Unpacking nvme-cli (1.9-1ubuntu0.1) ...
Setting up nvme-cli (1.9-1ubuntu0.1) ...
Processing triggers for man-db (2.9.1-1) ...