Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
openeuler_risc-v-visionfive [2022/06/11 07:12] – created misaka00251openeuler_risc-v-visionfive [2022/07/21 08:17] (current) misaka00251
Line 31: Line 31:
  
 默认的 img 只有 2 GB。我们要对其扩容。 默认的 img 只有 2 GB。我们要对其扩容。
 +
 +默认的设备名应该为 ''/dev/mmcblk0'',在这里我们使用 ''fdisk'' 进行操作,首先使用 ''fdisk -l'' 列出分区表:
 +
 +<code>
 +GPT PMBR size mismatch (4194303 != 124735487) will be corrected by write.
 +The backup GPT table is not on the end of the device.
 +Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 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: gpt
 +Disk identifier: 96F9C2E5-E969-4D86-941B-CEFBA947BA1E
 +
 +Device         Start     End Sectors Size Type
 +/dev/mmcblk0p1   256 4194270 4194015   2G unknown
 +</code>
 +
 +可以看到,我们的起始为 256,这个值一定要记住。然后使用 ''fdisk /dev/mmcblk0'' 来开始更改分区表。
 +
 +思路很简单:删除分区然后再创建新分区,但 Start 相同,然后不移除 signature。
 +
 +<code>
 +Command (m for help): d
 +
 +Selected partition 1
 +Partition 1 has been deleted.
 +
 +Command (m for help): n
 +Partition number (1-128, default 1): 1
 +First sector (34-124735454, default 2048): 256
 +Last sector, +/-sectors or +/-size{K,M,G,T,P} (256-124735454, default 124735454): 
 +
 +Created a new partition 1 of type 'Linux filesystem' and of size 59.5 GiB.
 +Partition #1 contains a ext4 signature.
 +
 +Do you want to remove the signature? [Y]es/[N]o: n
 +
 +Command (m for help): w
 +
 +The partition table has been altered.
 +Syncing disks.
 +</code>
 +
 +退出之后,我们再来用 ''fdisk -l'' 列出分区表看一下:
 +
 +<code>
 +Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 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: gpt
 +Disk identifier: 96F9C2E5-E969-4D86-941B-CEFBA947BA1E
 +
 +Device         Start       End   Sectors  Size Type
 +/dev/mmcblk0p1   256 124735454 124735199 59.5G Linux filesystem
 +</code>
 +
 +看上去很棒,最后使用 ''resize2fs /dev/mmcblk0p1'' 获取空间就可以了。