← Back to team overview

ubuntu-phone team mailing list archive

Re: [PATCH] Create swap file on first boot

 

Sorry for the late answer!

On 03/05/2013 06:02 AM, Ricardo Salveti de Araujo wrote:
On 03/01/2013 04:09 PM, f69m wrote:
Hi everyone,

Please find attached a small patch that will create /data/swapfile on
first boot.
If you don't want a swapfile, just create an empty /data/swapfile.

Pros:

  * The swap file can be removed from the rootfs, which makes that
    significantly smaller and faster to flash.
  * Once created, the swap file persists updates and does not need to be
    recreated.

Cons:

  * Can't think of any.

Details:

* The patch should be applied to git://phablet.ubuntu.com/ubuntu/uchroot.
  * Creates /data/swapfile, if it does not exist yet.
  * Runs swapon, if the file exists and is not empty.

Hope this patch is acceptable and can be included for everyone.

There's already a SWAP file at the ubuntu side (check /data/ubuntu/SWAP.swap).

Yes, I know. My goal was to remove it from the rootfs distribution.

But your solution might work better as we can remove this step from image build time.

Well, and from flash time. Though it probably compresses well, it is an extra 100 MB to be flashed each time you extract a new rootfs.

Removing both SWAP.swap and the redundant usr/share/demo-assets/pictures.tgz (same files unpacked in home) reduces the ZIP size to about 390 MB. This is a reduction of more than 20 %. And the speed-up for flashing is probably much more, as the swap file is likely to compress really well in the ZIP.

I'd just like an extra check in case there's not enough disk space before creating the swapfile.

That is a great idea, thanks!
I'll have a look into that.




Follow ups

References