Fedora ARM Secondary Architecture/rootfs-resize

From CDOT Wiki
Revision as of 03:57, 8 June 2012 by Chris Tyler (talk | contribs) (Location)
Jump to: navigation, search

The rootfs-resize script

rootfs-resize is a script included in Fedora 17 ARM and used to resize SD card images.

README

From the rootfs-resize tarball:

===== rootfs-resize version 0.1 - 2012-06-08 =====

rootfs-resize is a simple bash script designed for use on
ARM computers that use an SD card for storage. Since SD cards
can be purchased in various sizes, and since even cards of the
same nominal size may have slightly different capacities, it is
impossible to create an SD card image guaranteed to exactly fit
a card. It is also inefficient to have an image that is larger
than the files contained within that image, because the "extra
space" will/may slow compression, download, and SD-card burn
activities.

As a result, the Fedora ARM SD card images typically contain
a boot filesystem (usually FAT/VFAT) followed by a Linux extX
root filesystem. The second filesystem is sized so that it
is just big enough for the contained files.

The rootfs-resize script attempts to resize the root (second)
partition on the SD card to fill the device. At present, it
does this by deleting the root partition and then recreating
it to fill the card; on the next boot, a background resize2fs
is performed to resize the filesystem.

Minimal basic sanity-checking is performed: the device containing
the rootfs must contain exactly two partitions, as reported by
"fdisk -l". If additional partitions have been created, the
script will not run. The name of the block device containing the
root filesystem must be /dev/sdX or /dev/mmcblk0pX.

In order to resize the partition, the file /.rootfs-repartition
must be present. After the partition resize operation, this file
is removed and the file /.rootfs-resize is created; on next boot,
when the resize2fs is started, the /.rootfs-resize file is
removed.

The operation of this script may be disabled in either of these
two ways:

(1) By passing a kernel command line argument of "nofsresize"

(2) By creating the file /.nofsresize

If either of these suppressions flags are present, the script
will not run, and it will disable itself for future boots.

This script and the corresponding systemd unit file are licensed
under the GPL v2, or at the user's discretion, any later version.

This script is being included in Fedora 17 ARM, but the Fedora
ARM team intends to introduce a more advanced and robust resizing
mechanism in later releases.

Location

The rootfs-resize code can be found here: http://scotland.proximity.on.ca/fedora-arm/rootfs-resize

Credits

Please refer to the rootfs-resize script in the package/tarball for credits.

Future Plans

It is intended that this script will be replaced by a more advanced and robust mechanism in future Fedora ARM releases.