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

相关推荐
chlk1231 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑1 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件1 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒1 天前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI2 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行3 天前
Linux和window共享文件夹
linux
木心月转码ing3 天前
WSL+Cpp开发环境配置
linux
蝎子莱莱爱打怪4 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes