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

相关推荐
hopsky4 分钟前
docker 容器文件异常大的问题排查
运维·docker·容器
鹏大师运维5 分钟前
统信UOS CVE-2026-31431漏洞怎么修?先看漏洞,再看3种修复方法
linux·内核·deb·漏洞修复·统信uos·补丁·本地提权
feng_you_ying_li11 分钟前
liunx之软硬链接与库的制作原理(1)
linux
bloglin9999911 分钟前
兼容旧版 docker-compose 和新版 docker compose
运维·docker·容器
怀旧,12 分钟前
【Linux网络编程】6. 传输层协议 UDP
linux·网络·udp
宠..18 分钟前
VS Code 修改 C++ 标准同时修改错误检测标准
java·linux·开发语言·javascript·c++·python·qt
|_⊙19 分钟前
Linux 深入理解文件(IO)
linux·运维·服务器
kyle~23 分钟前
Linux时间系统4---从PHC_PTP到ROS 2驱动与控制链路
linux·运维·数码相机
largecode28 分钟前
给用户打电话,怎么在对方手机显示为“XX旅游”?号码认证办理教程
linux·服务器·容器·智能手机·ssh·旅游·vagrant
无限进步_37 分钟前
【Linux】vim:在终端里高效编辑
linux·运维·vim