先查看所有硬盘
lsblk
命令
xiaosheng@xiaosheng-linux ~ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 63.2M 1 loop /snap/core20/1634
loop2 7:2 0 63.2M 1 loop /snap/core20/1695
loop3 7:3 0 155.6M 1 loop /snap/firefox/1232
loop4 7:4 0 203.7M 1 loop /snap/firefox/2067
loop5 7:5 0 346.3M 1 loop /snap/gnome-3-38-2004/119
loop6 7:6 0 248.8M 1 loop /snap/gnome-3-38-2004/99
loop7 7:7 0 81.3M 1 loop /snap/gtk-common-themes/1534
loop8 7:8 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop9 7:9 0 45.9M 1 loop /snap/snap-store/575
loop10 7:10 0 45.9M 1 loop /snap/snap-store/599
loop11 7:11 0 43.6M 1 loop /snap/snapd/15177
loop12 7:12 0 48M 1 loop /snap/snapd/17336
loop13 7:13 0 284K 1 loop /snap/snapd-desktop-integration/10
loop14 7:14 0 284K 1 loop /snap/snapd-desktop-integration/14
sda 8:0 0 953.9G 0 disk
├─sda1 8:1 0 529M 0 part
├─sda2 8:2 0 100M 0 part
├─sda3 8:3 0 16M 0 part
├─sda4 8:4 0 349.4G 0 part
├─sda5 8:5 0 503.9G 0 part
└─sda6 8:6 0 100G 0 part
nvme0n1 259:0 0 953.9G 0 disk
├─nvme0n1p1 259:1 0 1.9G 0 part /boot/efi
├─nvme0n1p2 259:2 0 1K 0 part
├─nvme0n1p5 259:3 0 30.5G 0 part [SWAP]
└─nvme0n1p6 259:4 0 921.4G 0 part /var/snap/firefox/common/host-hunspell
/
可以看到我的sda6 是另一个磁盘上的,100G空间
我打算把他挂载到我的/home/xiaosheng/file
我先在/home/xiaosheng
目录下创建 了file
文件夹
磁盘初始化
现将磁盘初始化
注意我的路径
sudo mkfs -t ext4 /dev/sda6
加上sudo
防止磁盘已经有分区,无法初始化
挂载
sudo mount /dev/sda6 /home/xiaosheng/file/
df -h
查看挂载信息
✘ xiaosheng@xiaosheng-linux ~/file df -h
文件系统 容量 已用 可用 已用% 挂载点
tmpfs 3.2G 2.7M 3.2G 1% /run
/dev/nvme0n1p6 906G 29G 832G 4% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/nvme0n1p1 2.0G 5.3M 1.9G 1% /boot/efi
tmpfs 3.2G 140K 3.2G 1% /run/user/1000
/dev/sda6 98G 24K 93G 1% /home/xiaosheng/file
可以看到已经 挂载上了,下面需要进行设置永久挂载
永久挂载
先用命令查看硬盘信息
“
xiaosheng@xiaosheng-linux ~ blkid
/dev/nvme0n1p5: UUID="cb1bc0a0-dc78-4e6b-b30f-eb7969d4d9c6" TYPE="swap" PARTUUID="3f71f019-05"
/dev/nvme0n1p6: UUID="856b2def-bd32-4823-8506-23b512c83d06" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3f71f019-06"
/dev/sda6: UUID="f51f133d-5254-4bb1-a272-0c34db794d64" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7271f3f0-a400-4813-b499-b6e122a54cdd"
可以看到新要挂载的硬盘uuid: f51f133d-5254-4bb1-a272-0c34db794d64 类型为ext4
sudo vim /etc/fstab
然后退出
mount -a
没有报错信息输出,就是成功了