查看系统里面识别到的硬盘和分区的信息
$ sudo fdisk -l
Disk /dev/nvme1n1: 1.8 TiB, 2000398934016 bytes, 3907029168 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: FA514C81-E2C5-4A87-B1D4-1F5F1EF56607
Device Start End Sectors Size Type
/dev/nvme1n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme1n1p2 1050624 3907028991 3905978368 1.8T Linux filesystem
Disk /dev/nvme0n1: 1.8 TiB, 2000398934016 bytes, 3907029168 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: E62B9CAF-036D-49B9-80E8-9D4F537D1852
Device Start End Sectors Size Type
/dev/nvme0n1p1 64 204863 204800 100M EFI System
/dev/nvme0n1p2 206848 208895 2048 1M Linux filesystem
/dev/nvme0n1p3 8595456 8597503 2048 1M Linux filesystem
/dev/nvme0n1p5 208896 8595455 8386560 4G Microsoft basic data
/dev/nvme0n1p6 8597504 16984063 8386560 4G Microsoft basic data
/dev/nvme0n1p7 16986112 268435455 251449344 119.9G unknown
/dev/nvme0n1p8 268437504 3907029134 3638591631 1.7T unknown
Partition table entries are not in disk order.
Disk /dev/sda: 892.2 GiB, 957997907968 bytes, 1871089664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disklabel type: gpt
Disk identifier: B3B492D9-7CC4-428A-9CE3-036643661A8F
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 3147775 2097152 1G Linux filesystem
/dev/sda3 3147776 1871087615 1867939840 890.7G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
格式化硬盘
$ sudo parted /dev/nvme0n1
GNU Parted 3.2
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
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
(parted) print
Model: HWE52P432T0L002N (nvme)
Disk /dev/nvme0n1: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart primary 0 2000GB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) print
Model: HWE52P432T0L002N (nvme)
Disk /dev/nvme0n1: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 2000GB 2000GB primary
(parted) quit
Information: You may need to update /etc/fstab.
写入分区类型
$ sudo mkfs.ext4 /dev/nvme0n1
mke2fs 1.44.1 (24-Mar-2018)
Found a gpt partition table in /dev/nvme0n1
Proceed anyway? (y,N) y
Discarding device blocks: done
Creating filesystem with 488378646 4k blocks and 122101760 inodes
Filesystem UUID: 60b94695-8f59-4b28-9d6c-c2fcb177f7fa
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
查看
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 892.2G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 890.7G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 200G 0 lvm /
nvme0n1 259:0 0 1.8T 0 disk
nvme1n1 259:1 0 1.8T 0 disk
├─nvme1n1p1 259:2 0 512M 0 part
└─nvme1n1p2 259:3 0 1.8T 0 part
挂载
$ sudo mount /dev/nvme0n1 /apps/
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 189G 0 189G 0% /dev
tmpfs 38G 2.1M 38G 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 196G 24G 163G 13% /
tmpfs 189G 0 189G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 189G 0 189G 0% /sys/fs/cgroup
/dev/sda2 976M 146M 763M 17% /boot
/dev/sda1 511M 6.6M 505M 2% /boot/efi
tmpfs 38G 0 38G 0% /run/user/1000
/dev/nvme0n1 1.8T 77M 1.7T 1% /apps