在安装liunx系统后使用df -lh查看磁盘空间发现小于实际的磁盘空间,以下记录下怎么扩容
查看当前分区信息
#发现磁盘大小为120G左右
fdisk -l

#发现可用磁盘空间为15G
df -lh

扩容
#通过fdisk -l发现磁盘名称为:/dev/mmcblk0p1
#创建分区
root@orangepipc2:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
#输入m查看帮助

#输入p查看当前分区情况,如下图只有14.7G的空间
p

#输入n创建
n
#然后选择主分区
p
#设置磁盘号,默认即可 回车接下来一切默认即可

#发现两个但还是不对,继续创建分区,一切默认

#保存
w
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
#在执行partprobe
partprobe

#格式化,稍微等待
mkfs -t ext4 /dev/mmcblk0p3
#此时已经格式完成,待下一步挂载

挂载磁盘
#创建文件夹
mkdir storage
#永久挂载 vi /etc/fstab,最后一行添加
/dev/mmcblk0p3 /storage ext4 defaults 0 0

保存后重启系统即可,再次df -lh 可以看到多出的100多G的空间

网友评论