HOWTO: Extra disk space on XO-1.5 11.3.1 using fs-resize
James Cameron
quozl at laptop.org
Thu Mar 22 00:27:46 EDT 2012
How to obtain an extra 100 MB of disk space on an XO-1.5 using 11.3.1.
or
How to avoid downloading multiple sizes of a build for a set of XO-1.5
where the microSD or SD card size varies.
Background
The size of the microSD cards vary across manufacturer and model, and
our builds choose a root filesystem partition size that fits all the
qualified cards. On many cards, this leaves a gap. The gap varies by
card.
Also, our builds are sized for our qualified cards only, which means an
unqualified card of an unusual size may be wasted if not repartitioned.
Manual repartitioning has been difficult, but this changes with a new
feature of OpenFirmware, and the resize2fs online resize in 11.3.1.
Procedure
- reflash OpenFirmware to Q3C03, ... this is required because the
fs-resize command was added in Q3C03, (on XO-1.75, use Q4D06),
- use fs-update as usual to install the build, ... or if you already
have a build installed, skip this step,
- use fs-resize to resize the partition that holds the root filesystem,
... this changes the ending point of the partition so that it takes up
the remainder of the card, and is harmless to repeat,
- boot the operating system,
- use the command "sudo resize2fs /dev/mmcblk0p2" to resize the root
filesystem to the new size of the partition, ... this can be done
while the system is up and running,
Using an external high capacity SD card
Define the fsdisk alias in the same way as usual, and it will be used by
both fs-update and fs-resize.
Checking Results
- the partition table can be printed in OpenFirmware:
ok .partitions int
- the partition table can be checked using /proc/partitions, parted, or
gparted,
- the filesystem size can be checked with df.
Observed Results
- time taken for fs-resize ... less than a second,
- time taken for resize2fs on XO-1.5 for 4GB build on a 4GB microSD card
... six seconds,
- time taken for resize2fs on XO-1.75 for 4GB build on an 8GB eMMC, ...
fourteen seconds,
- space gained on an XO-1.5 for 4GB build on a 4GB microSD card ...
96160 blocks, roughly 100MB.
Example Output
ok fs-update u:\os31.zd4
...
ok .partitions int
Partition Region Boot Format Size (MB)
1 Primary Yes ext2 64
2 Primary No ext2 3618
ok fs-resize
ok .partitions int
Partition Region Boot Format Size (MB)
1 Primary Yes ext2 64
2 Primary No ext2 3714
ok boot
...
bash-4.1# df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mmcblk0p2 3646632 1647740 1961844 46% /
bash-4.1# cat /proc/partitions
major minor #blocks name
179 0 3872256 mmcblk0
179 1 65536 mmcblk0p1
179 2 3802624 mmcblk0p2
bash-4.1# time resize2fs /dev/mmcblk0p2
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mmcblk0p2 to 950656 (4k) blocks.
The filesystem on /dev/mmcblk0p2 is now 950656 blocks long.
real 0m6.090s
user 0m0.000s
sys 0m0.010s
bash-4.1# df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mmcblk0p2 3742792 1647756 2057988 45% /
bash-4.1#
References
http://dev.laptop.org/ticket/10040 (this will eventually be automatic)
http://dev.laptop.org/ticket/11690
http://wiki.laptop.org/go/OLPC_Firmware_q3c03
http://wiki.laptop.org/go/OLPC_Firmware_q4d06
http://wiki.laptop.org/go/OLPC_Firmware_q4d06/fs-resize
--
James Cameron
http://quozl.linux.org.au/
More information about the Devel
mailing list