博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
升级树莓派archlinux系统到新sd卡
阅读量:6911 次
发布时间:2019-06-27

本文共 4721 字,大约阅读时间需要 15 分钟。

由于之前把树莓派系统安装在4gb的sd卡上,随着系统的更新及安装了一大堆软件包之后,系统提示空间不足了。网上搜索了下,把所有数据迁移到新的sd卡上还是比较简单的。

 

克隆sd卡:

1,关闭树莓派电源,取出sd卡。插入到电脑的读卡器插槽中。

2,安装并运行Win32DiskImager。

3,在"Image File"选择框中,输入克隆的新文件路径。 例如,我放在"C:\Users\Yvan\Documents\archlinux.img"。

4, 在"Device"下拉框中,选择sd卡的盘符。

5,点击"Read"按钮,从sd卡中克隆新的镜像文件。

6,完成之后,插入新的sd卡,点击"Write",把之前生成的镜像文件写入到新的sd卡中。

克隆完之后,需要扩展分区。

步骤如下:

1. After logging in you view the status of filesystem:

[root@alarmpi ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/root       1.7G  444M  1.2G  28% /devtmpfs         83M     0   83M   0% /devtmpfs           231M     0  231M   0% /dev/shmtmpfs           231M  236K  231M   1% /runtmpfs           231M     0  231M   0% /sys/fs/cgrouptmpfs           231M     0  231M   0% /tmp/dev/mmcblk0p1   90M   24M   67M  27% /boot

2. Using the command fdisk will edit the filesystem /dev/mmcblk0:

[root@alarmpi ~]# fdisk /dev/mmcblk0Welcome to fdisk (util-linux 2.23.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command. Command (m for help):

3. List the information and delete partition 2

Command (m for help): p Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x00057540         Device Boot      Start         End      Blocks   Id  System/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)/dev/mmcblk0p2          186368     3667967     1740800    5  Extended/dev/mmcblk0p5          188416     3667967     1739776   83  Linux Command (m for help): dPartition number (1,2,5, default 5): 2Partition 2 is deleted Command (m for help):

4. Create a new extended partition a logical volume

Command (m for help): nPartition type:   p   primary (1 primary, 0 extended, 3 free)   e   extendedSelect (default p): ePartition number (2-4, default 2): 2First sector (186368-15564799, default 186368):Using default value 186368Last sector, +sectors or +size{
K,M,G} (186368-15564799, default 15564799):Using default value 15564799Partition 2 of type Extended and of size 7.3 GiB is set Command (m for help): nPartition type: p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5)Select (default p): lAdding logical partition 5First sector (188416-15564799, default 188416):Using default value 188416Last sector, +sectors or +size{
K,M,G} (188416-15564799, default 15564799):Using default value 15564799Partition 5 of type Linux and of size 7.3 GiB is set Command (m for help):

5. !! Check whether top block starts in the same place as the original (start)

Command (m for help): p Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x00057540         Device Boot      Start         End      Blocks   Id  System/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)/dev/mmcblk0p2          186368    15564799     7689216    5  Extended/dev/mmcblk0p5          188416    15564799     7688192   83  Linux Command (m for help):

6. If it starts again (in this case on 186368 p2 a 188416 p5) write changes and reboot.

Command (m for help): wThe 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 atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@alarmpi ~]# reboot

7. After booting the system we online enlarge root partitions

[root@alarmpi ~]# resize2fs /dev/mmcblk0p5resize2fs 1.42.8 (20-Jun-2013)Filesystem at /dev/mmcblk0p5 is mounted on /; on-line resizing requiredold_desc_blocks = 1, new_desc_blocks = 1The filesystem on /dev/mmcblk0p5 is now 1922048 blocks long.

8. Check and it is done :-)

[root@alarmpi ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/root       7.3G  447M  6.5G   7% /devtmpfs         83M     0   83M   0% /devtmpfs           231M     0  231M   0% /dev/shmtmpfs           231M  236K  231M   1% /runtmpfs           231M     0  231M   0% /sys/fs/cgrouptmpfs           231M     0  231M   0% /tmp/dev/mmcblk0p1   90M   24M   67M  27% /boot 参考:http://lifehacker.com/how-to-clone-your-raspberry-pi-sd-card-for-super-easy-r-1261113524 http://raspberry-hosting.com/faq/how-expand-arch-linux-root-partition http://elinux.org/RPi_Easy_SD_Card_Setup#Manually_resizing_the_SD_card_on_Raspberry_Pi

转载于:https://www.cnblogs.com/joe-yang/p/3691043.html

你可能感兴趣的文章
Ubuntu下用命令行快速打开各类型文件(转)
查看>>
C语言程序设计_zju——第3周编程练习1_时间换算
查看>>
Nodejs调用Aras Innovator服务,处理AML并返回AML
查看>>
纯数学教程 Page 324 正项级数绝对收敛的一种判别法
查看>>
解析函數論 Page 29 命題(1) 有界閉集上的一致連續性
查看>>
oracle 两个timstamp类型相减获取时间差
查看>>
简单工厂设计模式-模拟磁盘打开文件
查看>>
C#实体类get和set的作用
查看>>
表单验证<AngularJs>
查看>>
18.os模块获取url后缀
查看>>
精通正则表达式之正则引擎
查看>>
apache安装的一些问题
查看>>
SqlServer 为字段列添加扩展属性
查看>>
dev TreeList 节点联动
查看>>
汇编实验一——利用这3条指令计算2的8次方
查看>>
Java内部类
查看>>
GNU :6.47 Function Names as Strings
查看>>
Shell脚本编程(一)
查看>>
习题10-1 UVA 11040(无聊水一水)
查看>>
Robotframe work之环境搭建(一)
查看>>