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

相关推荐
AIgorithmGEEK2 分钟前
[Linux]从手写报头到内核套路:序列化、反序列化与自定义协议全链路
linux·运维·服务器·网络·序列化·反序列化
Nil20810 分钟前
leetcode 139单词拆分
linux·运维·服务器
Starry-sky(jing)15 分钟前
BUG: unable to handle kernel paging request 完整排查:dmesg 四要素与三路定罪
linux·运维·服务器·内核·排障
mounter62520 分钟前
从硬件互连到操作系统变革:CXL 技术演进与 Linux 内核工程挑战
linux·运维·服务器
zhengqweasd28 分钟前
机房托管服务器怎么选硬盘,机械盘和 SSD 托管场景差异
运维·服务器·github
xh didida2 小时前
Linux -- 基础IO
linux·服务器·开发语言·c++
心易行者2 小时前
Agent应用+API端点商业化进阶实战:从单体智能体到可付费调用的API全流程
运维·服务器·人工智能·python·apache
科技研学社2 小时前
精度决胜品质:羽绒服缝制工艺标准与自动化精度对标解析
运维·自动化
夜之眷属3 小时前
Core dump 崩溃排查:JVM 宕机后,那份 core 文件怎么用 gdb 还原现场
java·运维·服务器·jvm