on ext2/3 filesystems, create a swapfile inside teh rootfs

ubuntu/precise
Oliver Grawert 14 years ago
parent 9b6ddd4bb5
commit 891cd7fcdd

8
debian/changelog vendored

@ -1,3 +1,11 @@
livecd-rootfs (1.159) UNRELEASED; urgency=low
* create an empty swapfile on ext2/3 images by default, we care for use
or deletion on first boot, this cuts of 3min from the first boot of
preinstalled images.
-- Oliver Grawert <ogra@ubuntu.com> Wed, 23 Feb 2011 14:53:06 +0100
livecd-rootfs (1.158) natty; urgency=low livecd-rootfs (1.158) natty; urgency=low
* switch default session for armel netbook images to unity-2d * switch default session for armel netbook images to unity-2d

@ -76,8 +76,8 @@ livefs_squash()
livefs_ext2() livefs_ext2()
{ {
# Add 500MiB extra free space for first boot + ext3 journal # Add 1024MiB extra free space for first boot + ext3 journal + swapfile
size=$(($(du -ks ${ROOT} | cut -f1) + (512000))) size=$(($(du -ks ${ROOT} | cut -f1) + (1024000)))
MOUNTPOINT=$(mktemp -d) MOUNTPOINT=$(mktemp -d)
DEV=$(losetup -f) DEV=$(losetup -f)
echo "Building ext2 filesystem." echo "Building ext2 filesystem."
@ -93,6 +93,13 @@ livefs_ext2()
# copy chroot content to image # copy chroot content to image
cp -a ${ROOT}/* ${MOUNTPOINT} cp -a ${ROOT}/* ${MOUNTPOINT}
# Create a swapfile in rootfs we can use or delete later on during first boot.
# doing it *during* first boot adds 3min to the bootprocess so the decision
# was to do it here. Luckily the file will compress to nearly zero so it does
# not add to the image size once we gzipped the image.
dd if=/dev/zero of=${MOUNTPOINT}/SWAP.swap bs=1048576 count=512
mkswap ${MOUNTPOINT}/SWAP.swap
# clean up # clean up
umount ${MOUNTPOINT} umount ${MOUNTPOINT}
rm -rf ${MOUNTPOINT} rm -rf ${MOUNTPOINT}

Loading…
Cancel
Save