树莓派3B CentOS7 扩展分区

相关链接:

树莓派3B安装CentOS7

树莓派3B CentOS7 设置Wifi

# 查看硬盘分区信息
fdisk -l

image-20200927140725583

# 进入磁盘分区工具
fdisk /dev/mmcblk0
# 输入 p 查看分区情况

image-20200927141142776

# 删除第三个分区 /dev/mmcblk0p3
# 步骤如下

# 输入 d 回车, 进行删除分区操作
Command (m for help): d

# 输入需要删除的分区号 3
Partition number (1-3, default 3): 3
Partition 3 is deleted

# 输入 n 添加新的主分区(p)
Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
   
# 分区类型输入 p   
Select (default p): p

# 序号输入3
Partition number (3,4, default 3): 3

# 起始位置输入 1593344, 此处需要注意 卷3 原起始位置就是1593344,若是默认的话就尴尬了
First sector (2048-62333951, default 2048): 1593344

# 结束位置默认, 若想指定大小请手动输入, 默认将是最大值
Last sector, +sectors or +size{K,M,G} (1593344-62333951, default 62333951): 
Using default value 62333951
Partition 3 of type Linux and of size 29 GiB is set

# 输入 w 保存配置
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 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)
Syncing disks.
# 重启
reboot
# 刷新分区
resize2fs /dev/mmcblk0p3
输入 df -h 可以查看已经扩展完成的root已经变成27G
文件系统        容量  已用  可用 已用% 挂载点
/dev/root        28G  1.3G   27G    5% /
devtmpfs        395M     0  395M    0% /dev
tmpfs           428M     0  428M    0% /dev/shm
tmpfs           428M   12M  417M    3% /run
tmpfs           428M     0  428M    0% /sys/fs/cgroup
/dev/mmcblk0p1  286M   51M  236M   18% /boot
tmpfs            86M     0   86M    0% /run/user/0
原文地址:https://www.cnblogs.com/Jerrycjc/p/15248639.html