遇到用yocto gpt硬像檔燒好的SD, rootfs 沒有填滿整個SD卡剩餘空間
./flash_tool.sh -c rk3399 -p system -i build_ex_dir/tmp/deploy/images/excavator-rk3399/core-image-base-excavator-rk3399-gpt.img -d /dev/sdc
查看SD卡分割區有無問題
查看分割區資訊
root@test-desktop:/home/share/rk3399/rk-yocto-bsp# blkid
…….
/dev/sdc4: SEC_TYPE="msdos" LABEL="boot" UUID="F8D3-AFE9" TYPE="vfat" PARTLABEL="boot" PARTUUID="dd920453-fe2f-4a7f-8e77-2fe7cd65942c"
/dev/sdc1: PARTLABEL="loader1" PARTUUID="698c4695-e00a-4f19-95c8-7148dc1edf72"
/dev/sdc2: PARTLABEL="loader2" PARTUUID="b6aa79aa-f8a9-4c43-ae74-e848ef2d7afd"
/dev/sdc3: PARTLABEL="trust" PARTUUID="a38ed6c3-779e-4728-998d-ba682d65beae"
/dev/sdc5: UUID="6aeb3ae7-6918-4a3e-befc-8d0e643631aa" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="b921b045-1df0-41c3-af44-4c6f280d3fae"
因為不明原因 rootfs 只有 68M 所以要更換rootfs 可能會空間不夠
且發現 GPT PMBR size mismatch 錯誤 故先修正錯誤再更改空間
root@test-desktop:/home/share/rk3399/rk-yocto-bsp# 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.
GPT PMBR size mismatch (395263 != 61521919) will be corrected by w(rite).
GPT PMBR size mismatch (395263 != 61521919) will be corrected by w(rite).
root@test-desktop:/home/share/rk3399/rk-yocto-bsp# parted -l
Model: ATA WDC WD10EZEX-00B (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
……………………..
Warning: Not all of the space available to /dev/sdc appears to be used, you can
fix the GPT to use all of the space (an extra 61126656 blocks) or continue with
the current setting?
Fix/Ignore? Fix
Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sdc: 31.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32.8kB 4129kB 4096kB loader1
2 8389kB 12.6MB 4194kB loader2
3 12.6MB 16.8MB 4194kB trust
4 16.8MB 134MB 117MB fat16 boot boot, esp
5 134MB 202MB 68.1MB ext4 rootfs
Model: (file)
Disk /dev/sdd: 202MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32.8kB 4129kB 4096kB loader1
2 8389kB 12.6MB 4194kB loader2
3 12.6MB 16.8MB 4194kB trust
4 16.8MB 134MB 117MB fat16 boot boot, esp
5 134MB 202MB 68.1MB ext4 rootfs
root@test-desktop:/home/share/rk3399/rk-yocto-bsp#
root@test-desktop:/media/test# parted -s /dev/sdc resizepart 5 '100%'
root@test-desktop:/media/test# e2fsck -f /dev/sdc5
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdc5: 1928/16384 files (0.9% non-contiguous), 45301/65536 blocks
root@test-desktop:/media/test# resize2fs /dev/sdc5
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/sdc5 to 30629868 (1k) blocks.
The filesystem on /dev/sdc5 is now 30629868 (1k) blocks long.