This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
fuss:linux [2020/11/02 04:51] – [Access Directory Underneath Mountpoint] office | fuss:linux [2021/04/16 19:21] – [Self-Delete Shell Script] office | ||
---|---|---|---|
Line 1202: | Line 1202: | ||
rm -rf -- " | rm -rf -- " | ||
</ | </ | ||
+ | |||
+ | ====== Resize Last Partition and Filesystem in Image File ====== | ||
+ | |||
+ | Assuming that an image file is available and named, for example, '' | ||
+ | |||
+ | First, extend the image file '' | ||
+ | <code bash> | ||
+ | dd if=/ | ||
+ | </ | ||
+ | where: | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | In this case, the image file '' | ||
+ | <code bash> | ||
+ | qemu-img resize raspios.img +500M | ||
+ | </ | ||
+ | |||
+ | The next step is to run '' | ||
+ | <code bash> | ||
+ | parted raspios.img | ||
+ | </ | ||
+ | |||
+ | and then resize the partition, for example: | ||
+ | <code bash> | ||
+ | (parted) resizepart 2 100% | ||
+ | </ | ||
+ | where: | ||
+ | * '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The final step is to enlarge the filesystem within the second partition that has just been extended by $500MiB$. '' | ||
+ | <code bash> | ||
+ | kpartx -avs raspios.img | ||
+ | </ | ||
+ | |||
+ | First, the existing filesystem has to be checked: | ||
+ | <code bash> | ||
+ | e2fsck -f / | ||
+ | </ | ||
+ | where: | ||
+ | * ''/ | ||
+ | |||
+ | and then finally the filesystem is extended to its maximum size: | ||
+ | <code bash> | ||
+ | resize2fs / | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||