ROS命令管理器-压缩树莓派sd卡镜像的空间
说明
- 通过dd方式备份出来是原SD卡的大小,通常一个32G/64G的sd卡,备份时间就比较旧,加上恢复的时间就更久。
- 通过压缩镜像空间,可以大大缩短传输和恢复镜像的时间
- 环境: 独立的ubuntu主机 + rcm
步骤
- 利用rcm工具实现对镜像的缩减
- 假设源镜像地址位于:
~/ailibot.img
, 大小为15G
# 安装rcm
curl -k https://www.ncnynl.com/rcm.sh | bash -
# 缩小镜像
rcm common --imgsrc ~/ailibot.img --imgdes ~/ailibot_s.img
- 效果如下:
sd_system_smaller
This script is under DEV state !
Base on project : https://github.com/Drewsif/PiShrink
sd_system_smaller start ...
/home/ubuntu/ailibot.img - /home/ubuntu/ailibot_s.img
PiShrink have installed!!
Begin to make image smaller!
Your imgsrc is:/home/ubuntu/ailibot.img
Your imgdes is:/home/ubuntu/ailibot_s.img
pishrink.sh v0.1.3
pishrink.sh: Copying /home/ubuntu/ailibot.img to /home/ubuntu/ailibot_s.img... ...
pishrink.sh: Gathering data ...
Creating new /etc/rc.local
pishrink.sh: Checking filesystem ...
PI_ROOT: 336607/969136 files (0.9% non-contiguous), 2386754/3873152 blocks
resize2fs 1.46.5 (30-Dec-2021)
pishrink.sh: Shrinking filesystem ...
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/loop26 to 2567698 (4k) blocks.
Begin pass 2 (max = 360713)
Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 119)
Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 37334)
Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop26 is now 2567698 (4k) blocks long.
pishrink.sh: Shrinking image ...
pishrink.sh: Shrunk /home/ubuntu/ailibot_s.img from 15G to 9.9G ...
- 首次使用,会自动下载脚本
- 经过压缩之后,原来15G的空间,缩小到9.9G
- 再按平常恢复镜像的方法来恢复就可以,会根据你的新sd卡大小自动扩充系统分区大小
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号