2022/12/02 15:27
1、 查询当前SD卡情况,输入“df -h ./”
# df -h ./
Filesystem Size Used Available Use% Mounted on
/dev/root 226.4M 149.3M 61.2M 71% /
2、输入命令:fdisk /dev/mmcblk0
# fdisk /dev/mmcblk0
The number of cylinders for this disk is set to 121280.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p ----------------->打印disk信息
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
121280 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 512,0,1 1023,3,32 65536 565247 499712 244M 83 Linux
Command (m for help): d ------------------------------>删除分区
Selected partition 1
Command (m for help): p ------------------------------>打印信息确认是否删除成功
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
121280 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
Command (m for help): n ------------------------------> 新建分区
Partition type
p primary partition (1-4)
e extended
p ---------------------------------->选择primary partiton
Partition number (1-4): 1 ----------------------------------->选择1
First sector (32-15523839, default 32): 65536 ------------------------->设置第一个sector
Last sector or +size{,K,M,G,T} (65536-15523839, default 15523839): --------------------->默认选择default
Using default value 15523839
Command (m for help): p ------------------------------->打印看看是否创建成功
Disk /dev/mmcblk0: 7580 MB, 7948206080 bytes, 15523840 sectors
121280 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 512,0,1 1023,3,32 65536 15523839 15458304 7548M 83 Linux
Command (m for help): w ------------------------>保存
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy
3、重启
# reboot ---------------------------> 重启
4、扩展逻辑卷
# resize2fs /dev/mmcblk0p1 ------------------------>扩展逻辑卷
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /d[ 23.384760] EXT4-fs (mmcblk0p1): resizing filesystem from 245760 to 7729152 blocks
ev/mmcblk0p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 30
[ 24.348429] EXT4-fs (mmcblk0p1): resized filesystem to 7729152
The filesystem on /dev/mmcblk0p1 is now 7729152 (1k) blocks long.
5、查看SD卡情况
# df -h ./ --------------------------->再次看看SD卡情况,已经扩到最大
Filesystem Size Used Available Use% Mounted on
/dev/root 7.1G 149.3M 6.7G 2% /