欢迎光临
我们一直在努力

如何给Linux挂载硬盘

linux有硬盘却看不到空间?这个时候需要挂载硬盘空间!教程附上,并非手把手,举一反三

lsblk显示所有硬盘和分区


root@OpenWrt:/# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  51.4M  0 loop /mnt/loop0
sda      8:0    0 119.2G  0 disk 
├─sda1   8:1    0    16M  0 part /mnt/sda1
└─sda2   8:2    0   300M  0 part /rom

cfdisk (如果有不止一块硬盘,命令后面需要加上盘符 例如/dev/..)

lsblk


root@OpenWrt:/# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  51.4M  0 loop /overlay
sda      8:0    0 119.2G  0 disk 
├─sda1   8:1    0    16M  0 part /boot
├─sda2   8:2    0   300M  0 part /rom
├─sda3   8:3    0     1K  0 part 
├─sda5   8:5    0     1G  0 part 
├─sda6   8:6    0    15G  0 part 
└─sda7   8:7    0   103G  0 part 

mkfs.ext4 /dev/sda5 格式化分区


root@OpenWrt:/# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  51.4M  0 loop /mnt/loop0
sda      8:0    0 119.2G  0 disk 
├─sda1   8:1    0    16M  0 part /mnt/sda1
├─sda2   8:2    0   300M  0 part /rom
├─sda3   8:3    0     1K  0 part 
├─sda5   8:5    0     1G  0 part 
├─sda6   8:6    0    15G  0 part 
└─sda7   8:7    0   103G  0 part 
root@OpenWrt:/# mount /dev/sda5 /mnt/sda5 #挂在sda5
root@OpenWrt:/# mount /dev/sda6 /mnt/sda6 #挂在sda6
root@OpenWrt:/# mount /dev/sda7 /mnt/sda7 #挂在sda7
root@OpenWrt:/# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  51.4M  0 loop /mnt/loop0
sda      8:0    0 119.2G  0 disk 
├─sda1   8:1    0    16M  0 part /mnt/sda1
├─sda2   8:2    0   300M  0 part /rom
├─sda3   8:3    0     1K  0 part 
├─sda5   8:5    0     1G  0 part /mnt/sda5
├─sda6   8:6    0    15G  0 part /mnt/sda6
└─sda7   8:7    0   103G  0 part /mnt/sda7
root@OpenWrt:/# 

overlay软路由openwrt的配置文件,需要扩容!


root@OpenWrt:/# cp -r /overlay/* /mnt/sda5 #备份overlay里面配置文件 不然扩容overlay文件之后所做的全部白费
root@OpenWrt:/# ls /mnt/sda5
lost+found  upper       work   #看到upper   work备份成功

文章来源于互联网:如何给Linux挂载硬盘

赞(0)
未经允许不得转载:莱卡云 » 如何给Linux挂载硬盘