Amyaz的博客

您所在的位置:网站首页 香橙派搭建nas Amyaz的博客

Amyaz的博客

2023-03-13 15:20| 来源: 网络整理| 查看: 265

Pi 调整 TF 卡大小 2019-04-07

入手一块 Orange Pi Zero,看重它的性价比(没错,就是穷)。将系统烧录到 TF 卡时,不会使用全部 TF 卡容量,造成浪费。经过一阵搜索,找到调整 TF 卡大小的方法,调大增加使用空间,调小便于保存系统镜像。

Armbian 系统 会自动扩容全部 TF 卡空间,不需要手动调整。

将 TF 卡插入电脑,打开 Linux 虚拟机,把 TF 卡添加到 USB 筛选器。(直接把 TF 卡插入 Linux 电脑也可以)在 Linux 终端操作:

1234sudo fdisk -l //查看所有存储设备,根据大小确定 TF 卡是 /dev/ 开头的哪个,并可看到分区情况sudo e2fsck -f /dev/sdb2 //整理第二分区,有的系统只有一个分区,就是 sdb1sudo resize2fs /dev/sdb2 1G //调整大小,调小加上 Pi 已占用空间大小(这里为 1G,可在 Pi 下用 df -h 查看),调大不用sudo fdisk /dev/sdb //实际调整,小心操作!!!

进入 fdisk 命令操作,调整容量过程是:先删除第二分区,再新建分区为调整后的大小。

12345678910111213141516171819202122232425Welcome to fdisk (util-linux 2.29.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): dPartition number (1,2, default 2):Partition 2 has been deleted.Command (m for help): nPartition 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 (1026048-31116287, default 1026048):Last sector, +sectors or +size{K,M,G,T,P} (1026048-31116287, default 31116287): +1G //调小 +1G,调大留空Created a new partition 2 of type 'Linux' and of size 3 GiB.Partition #2 contains a ext4 signature.Do you want to remove the signature? [Y]es/[N]o: n //一定要填 n,不移除Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.

操作完成,如果调小要保存系统镜像,使用 Win32 Disk Imager 读取 TF 卡,记得勾选仅读取已分配分区。

将保存的系统镜像烧录到新的 TF 卡,可以使用上面的步骤恢复容量。

当然也可直接在 Pi 上进行:

12sudo fdisk -l //TF 卡在 Pi 上识别为 /dev/mmcblk0sudo fdisk /dev/mmcblk0

按上面的操作先删除第二分区再新建,最后会有 WARNING: Re-reading the partition table failed with error 16 这样的提示,没关系,输入

1reboot

重启,输入

1resize2fs /dev/mmcblk0p2

使用 df -h 查看,容量已经调整。

香橙派 扩容

展开全文 >>



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3