How To Expand Rootfs Size
- This guide is for those who using OpenMediaVault.
- Operation confirmed with OMV for ODROID (OMV_3_0_92_Odroidxu4_4.9.61.img.xz).
- Test environments.
- ODROID-XU4 with 64GB eMMC
- ODROID-HC1/HC2 with 16GB MicroSD
OMV for ODROIDs is set to resize rootfs to 7GB only.
Refer to this file.
- target
root@odroidxu4:~# cat /root/.rootfs_resize 14700000s
The system reads this file when its first boot time and resizes the root partition and reboots itself to apply changes.
This is for the reason that some people use the root partition as a storage for their personal data so that would causes system instability.
So the developer team has intended to set the limitations of use root partition by restricting partitions' size.
And for the same reason, you can't create a shared folder with root partition.
But if you want to resize to use full storage of the boot media(MicroSD or eMMC), you can expand the size by following this guide.
Update OMV
It is recommended to update your OMV before proceeding.
Move to OMV System - Update Management, and check available updates and update it if there are.
Check current partitions
Move to OMV Storage - File Systems menu to check file systems.
It shows only 7GB even I inserted bigger one.
Connect to OMV via SSH protocol
Permit SSH root login to expand that.
Move to OMV Services - SSH menu and switch on Permit root login option, and then save and apply changes.
Open terminal or some SSH access program and login to your OMV as root account.
If it is a first time for login as root account, change password prompt will appear. You have to change that to proceed.
Check partitions again.
- target
root@odroidxu4:~# fdisk -l ... Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 139263 131072 64M 83 Linux /dev/mmcblk0p2 139264 14700000 14560737 7G 83 Linux /dev/mmcblk0p3 14700001 120921279 106221279 50.7G 83 Linux ...
See the /dev/mmcblk0p2 partition. It is expanded to 14700000 sector as written in /root/.rootfs_resize.
And 106221279 sectors remain, in my case.
Resize root partition
Enter the following commands to resize.
Make sure the device name of the boot media that has root partition. Assume that /dev/mmcblk0 is that in this guide.
Do not specify the partition number like /dev/mmcblk0p1.
- target
root@odroidxu4:~# fdisk /dev/mmcblk0 Welcome to fdisk (util-linux 2.25.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help):
Enter the commands like below to re-partitioning your boot media.
- target
Command (m for help): p Disk /dev/mmcblk0: 58.2 GiB, 62537072640 bytes, 122142720 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: dos Disk identifier: 0xd6a661fd Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 139263 131072 64M 83 Linux /dev/mmcblk0p2 139264 14700000 14560737 7G 83 Linux /dev/mmcblk0p3 14700001 120921279 106221279 50.7G 83 Linux Command (m for help): d Partition number (1-3, default 3): 3 Partition 3 has been deleted. Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 has been deleted. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): 2 First sector (2048-122142719, default 2048): 139264 Last sector, +sectors or +size{K,M,G,T,P} (139264-122142719, default 122142719): Created a new partition 2 of type 'Linux' and of size 58.2 GiB. Command (m for help): p Disk /dev/mmcblk0: 58.2 GiB, 62537072640 bytes, 122142720 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: dos Disk identifier: 0xd6a661fd Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 139263 131072 64M 83 Linux /dev/mmcblk0p2 139264 122142719 122003456 58.2G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Re-reading the partition table failed.: Device or resource busy The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8). root@odroidxu4:~#
Case 1. Enter the following commands to apply changes for btrfs format.
- target
root@odroidxu4:~# partprobe Warning: Error fsyncing/closing /dev/mmcblk0rpmb: Input/output error Warning: Error fsyncing/closing /dev/mmcblk0rpmb: Input/output error root@odroidxu4:~# btrfs filesystem resize max / Resize '/' of 'max' root@odroidxu4:~# sync
Case 2. If you are using ext2, ext3 and ext4 filesystem, enter the following commands to apply.
- target
root@odroid:~# resize2fs /dev/<path/of/card> e.g : /dev/mmcblk1p2 resize2fs 1.46.5 (30-Dec-2021) Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk1p2 is now 1907456 (4k) blocks long.
Reboot your ODROID.
- target
root@odroidxu4:~# reboot