Ubuntu 挂载新盘

1.磁盘分区

复制代码
root@ljz:/# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0     7:0    0     4K  1 loop /snap/bare/5
loop1     7:1    0 104.2M  1 loop /snap/core/17200
loop2     7:2    0  73.9M  1 loop /snap/core22/1908
loop3     7:3    0 104.6M  1 loop /snap/core/17210
loop4     7:4    0 221.4M  1 loop /snap/gnome-3-34-1804/21
loop5     7:5    0 505.1M  1 loop /snap/gnome-42-2204/176
loop6     7:6    0  12.2M  1 loop /snap/snap-store/1216
loop7     7:7    0  73.9M  1 loop /snap/core22/1963
loop8     7:8    0 218.4M  1 loop /snap/gnome-3-34-1804/93
loop9     7:9    0  55.4M  1 loop /snap/core18/2846
loop10    7:10   0  55.4M  1 loop /snap/core18/2855
loop11    7:11   0   516M  1 loop /snap/gnome-42-2204/202
loop12    7:12   0  48.3M  1 loop /snap/gtk-common-themes/1474
loop13    7:13   0  91.7M  1 loop /snap/gtk-common-themes/1535
loop14    7:14   0  12.9M  1 loop /snap/snap-store/1113
sda       8:0    0 238.5G  0 disk
├─sda1    8:1    0   512M  0 part /boot/efi
└─sda2    8:2    0   238G  0 part /
nvme0n1 259:0    0 465.8G  0 disk
root@ljz:/# sudo fdisk /dev/nvme0n1

Welcome to fdisk (util-linux 2.34).
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 0x326745dd.

Command (m for help): p
Disk /dev/nvme0n1: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: BIWIN NV7200 500GB                      
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: dos
Disk identifier: 0x326745dd

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):  
First sector (2048-976773167, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-976773167, default 976773167): 488386583

Created a new partition 1 of type 'Linux' and of size 232.9 GiB.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (488386584-976773167, default 488388608):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (488388608-976773167, default 976773167):

Created a new partition 2 of type 'Linux' and of size 232.9 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@ljz:/# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0     4K  1 loop /snap/bare/5
loop1         7:1    0 104.2M  1 loop /snap/core/17200
loop2         7:2    0  73.9M  1 loop /snap/core22/1908
loop3         7:3    0 104.6M  1 loop /snap/core/17210
loop4         7:4    0 221.4M  1 loop /snap/gnome-3-34-1804/21
loop5         7:5    0 505.1M  1 loop /snap/gnome-42-2204/176
loop6         7:6    0  12.2M  1 loop /snap/snap-store/1216
loop7         7:7    0  73.9M  1 loop /snap/core22/1963
loop8         7:8    0 218.4M  1 loop /snap/gnome-3-34-1804/93
loop9         7:9    0  55.4M  1 loop /snap/core18/2846
loop10        7:10   0  55.4M  1 loop /snap/core18/2855
loop11        7:11   0   516M  1 loop /snap/gnome-42-2204/202
loop12        7:12   0  48.3M  1 loop /snap/gtk-common-themes/1474
loop13        7:13   0  91.7M  1 loop /snap/gtk-common-themes/1535
loop14        7:14   0  12.9M  1 loop /snap/snap-store/1113
sda           8:0    0 238.5G  0 disk
├─sda1        8:1    0   512M  0 part /boot/efi
└─sda2        8:2    0   238G  0 part /
nvme0n1     259:0    0 465.8G  0 disk
├─nvme0n1p1 259:1    0 232.9G  0 part
└─nvme0n1p2 259:2    0 232.9G  0 part

root@ljz:/# lsblk

root@ljz:/# sudo fdisk /dev/nvme0n1

Command (m for help): p

Command (m for help): n

Select (default p): p

Command (m for help): n

Select (default p): p

Partition number (2-4, default 2):

First sector (488386584-976773167, default 488388608):(计算结果)

Last sector, +/-sectors or +/-size{K,M,G,T,P} (488388608-976773167, default 976773167):

Created a new partition 2 of type 'Linux' and of size 232.9 GiB.

root@ljz:/# lsblk

nvme0n1 259:0 0 465.8G 0 disk

├─nvme0n1p1 259:1 0 232.9G 0 part

└─nvme0n1p2 259:2 0 232.9G 0 part

二.文件挂载

1.lsblk -f 可以查看当前所有的盘分区的的文件类型

强制修改所挂载盘的类型

sudo mkfs.ext4 /dev/nvme0n1p1

选定文件夹目录挂载盘。此时要注意盘的类型和名称

sudo mount /dev/nvme0n1p1 /home/ljz/Open_source

相关推荐
tzhou6445216 小时前
Nginx 性能优化与防盗链配置
运维·nginx·性能优化
q***656916 小时前
使用Canal将MySQL数据同步到ES(Linux)
linux·mysql·elasticsearch
热爱学习的小怪兽16 小时前
Docker容器的一些总结
运维·docker·容器
2301_8075832316 小时前
了解python,并编写第一个程序,常见的bug
linux·python
要站在顶端16 小时前
基于 curl 实现 Jenkins 上传制品到 JFrog Artifactory
运维·ci/cd·jenkins
杨德杰17 小时前
Ubuntu设置VNC远程桌面
linux·运维·ubuntu
HIT_Weston17 小时前
43、【Ubuntu】【Gitlab】拉出内网 Web 服务:静态&动态服务
前端·ubuntu·gitlab
M***299117 小时前
在 Ubuntu 上安装 MySQL 的详细指南
mysql·ubuntu·adb
写代码的学渣17 小时前
Ubuntu/麒麟默认锁定root账户
linux·运维·ubuntu
wdfk_prog18 小时前
[Linux]学习笔记系列 -- [block]bfq-iosched
linux·笔记·学习