ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

尽可能小的备份树莓派,以及烧录后如何重新扩展主分区

2021-04-15 14:59:21  阅读:203  来源: 互联网

标签:树莓 default 备份 bytes 烧录 dev 512 分区 size


备份

推荐使用这个脚本来一键式备份:https://github.com/zlj-zz/RaspberryBackup

包括检测和下载需要的工具,备份系统,压缩镜像。

扩展主分区

  1. 将烧录镜像的 SD 插到电脑中, 系统为 ubuntu,识别为 /dev/sdc2,会自动挂载,我电脑挂载到 /media/ubuntu/rootfs

  2. 取消挂载 sudo umount /media/ubuntu/rootfs

  3. 可能提示设备 busy,结束使用磁盘的程序 sudo fuser -m -i -v -k /media/ubuntu/rootfs, 然后重新取消挂载

  4. 重新分区 fdisk

    • sudo fdisk /dev/sdc
     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): p                                 # p 查看信息
     Disk /dev/sdc: 29.6 GiB, 31719424000 bytes, 61952000 sectors
     Units: sectors of 1 * 512 = 512 bytes
     Sector size (logical/physical): 512 bytes / 512 bytes
     I/O size (minimum/optimal): 512 bytes / 512 bytes
     Disklabel type: dos
     Disk identifier: 0x340bfd6e
    
     Device     Boot  Start      End  Sectors  Size Id Type
     /dev/sdc1         8192   532479   524288  256M  c W95 FAT32 (LBA)
     /dev/sdc2       532480 23443455 22910976 10.9G 83 Linux
    
     Command (m for help): d                                 # d 删除分区
     Partition number (1,2, default 2): 2
    
     Partition 2 has been deleted.
    
     Command (m for help): n                                 # n 新建分区
     Partition type
        p   primary (1 primary, 0 extended, 3 free)
        e   extended (container for logical partitions)
     Select (default p):
    
     Using default response p.
     Partition number (2-4, default 2):
     First sector (2048-61951999, default 2048): 532480      # 要和原来的磁盘柱一致
     Last sector, +sectors or +size{K,M,G,T,P} (532480-61951999, default 61951999):
    
     Created a new partition 2 of type 'Linux' and of size 29.3 GiB.
    
     Command (m for help): p
     Disk /dev/sdc: 29.6 GiB, 31719424000 bytes, 61952000 sectors
     Units: sectors of 1 * 512 = 512 bytes
     Sector size (logical/physical): 512 bytes / 512 bytes
     I/O size (minimum/optimal): 512 bytes / 512 bytes
     Disklabel type: dos
     Disk identifier: 0x340bfd6e
    
     Device     Boot  Start      End  Sectors  Size Id Type
     /dev/sdc1         8192   532479   524288  256M  c W95 FAT32 (LBA)
     /dev/sdc2       532480 61951999 61419520 29.3G 83 Linux
    
     Command (m for help): wp                                # 保存退出
     The partition table has been altered.
    
    
  5. 检查分区信息 e2fsck -f /dev/sdc2

  6. 调整分区大小 resize2fs -p /dev/sdc2

标签:树莓,default,备份,bytes,烧录,dev,512,分区,size
来源: https://blog.csdn.net/qq_38410494/article/details/115724887

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有