当安装linaro系统后,发现使用dd烧写的系统只能使用到1G存储空间,而实际上有8G空间没有使用,此时就需要使用resize2fs来进行磁盘空间的扩容,烧写系统,到这里http://releases.linaro.org/14.06/ubuntu/arndale-octa下载最新的arndale-octa-trusty_server_20140623-668.img.gz文件,随后解压缩并烧写到tf卡上:
sdX需要使用fdisk -l查看对应的tf卡挂载到的磁盘号,千万小心!!
gunzip arndale-octa-trusty_server_20140623-668.img.gz
dd if=arndale-octa-trusty_server_20140623-668.img of=/dev/sdX bs=4M
写完成后,插入tf卡,启动系统,运行以下脚本fdisk.sh
#!/bin/bash
# resize the arndale octa board linaro system rootfs capacity
# jefby
# jef199006@gmail.com
# 2015-6-6
fdisk_first() {
p3_start=`fdisk -l /dev/mmcblk1 | grep mmcblk1p3 | awk '{print $2}'`
echo "Found the start point of mmcblk1p3: $p2_start"
fdisk /dev/mmcblk1 << __EOF__ >> /dev/null
d
3
n
p
3
$p3_start
p
w
__EOF__
sync
touch /root/.resize
echo "Ok, Partition resized, please reboot now"
echo "Once the reboot is completed please run this script again"
}
resize_fs() {
echo "Activating the new size"
resize2fs /dev/mmcblk1p3 >> /dev/null
echo "Done!"
echo "Enjoy your new space!"
rm -rf /root/.resize
}
if [ -f /root/.resize ]; then
resize_fs
else
fdisk_first
fi
重启后再运行一次,随后使用df -h命令查看,此时可以看到可用空间已经为8G了,如下图: