Bug 340153

Summary: use existing swap file instead of recreating it each time during installation
Product: [openSUSE] openSUSE 11.1 Reporter: peter czanik <peter>
Component: InstallationAssignee: Steffen Winterfeldt <snwint>
Status: RESOLVED FEATURE QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P5 - None CC: aschnell, matt, snwint, tgoettlicher
Version: Beta 5   
Target Milestone: Future/Later   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description peter czanik 2007-11-08 10:53:49 UTC
A great feature was added to 10.3, the possibility to use swap files during installation ( http://lists.opensuse.org/opensuse-factory/2007-05/msg00395.html ). This makes possible to install 10.3 on low RAM machines.

Problem: currently the installer creates a _new_ swap file on each installation, even if the file is already available. Creating a 1GB swap file on an USB key might take half an hour, which adds considerably to the installation time.

Enhancement: Please make it possible to use existing files as swap files, as this could drastically shorten installation times.
Comment 1 Matt Sealey 2007-11-08 11:56:36 UTC
My comment here will be that obviously the use of existing swap files must be able to check if the file is real or sparse, and perhaps if it is already a valid swap file.

Actually the check should be reversed, the presence of a swap header implies that the file is not sparse since mkswap will not operate on sparse files. This optimizes out the need to mkswap on a potentially slow medium (even 10 or 20 seconds is a long time to hang around).

If the file is not a valid swap file then mkswap should be run, which will confirm that it is not sparse, then it can be activated.

If the file fails mkswap then recreation of the swap file can be entertained. I wonder about the performance of making a swap file - is "dd" the best solution? As a preexisting tool it may be easier to entertain, but perhaps filling an existing file or creating it through some other method (fallocate?/fopen/fwrite loop/fclose..) is faster than starting from 0 and extending it?
Comment 2 Steffen Winterfeldt 2007-11-08 12:05:03 UTC
Checking for a valid swap sig would be ok.
Comment 3 Arvin Schnell 2007-11-13 12:58:25 UTC
Linuxrc does swap activation for installation.
Comment 4 Matt Sealey 2008-10-24 19:44:40 UTC
Nudging this bug as it's still open and not sure of the status. I will test the swap activation this weekend (mem=256, precreated file on USB using dd) and see what happens and report back. 
Comment 5 Matt Sealey 2008-11-24 20:48:15 UTC
*** Bug 438890 has been marked as a duplicate of this bug. ***
Comment 6 Matt Sealey 2008-11-24 20:54:32 UTC
Bump!

The swap activation seems to be okay now but it relies on user interaction (to pick a file from somewhere) or worse, having a dedicated partition for it for addswap= parameter which requires manually partitioning the disk beforehand or using an evil slow USB stick (which still has to be chosen).

Is it possible to activate swap and modify the addswap= parameter such that it uses Linuxrc paths instead of finding a block device entry from somewhere? This would help for the case where a file must be used.

We have a use case where we want to configure a disk automatically and then reboot into the SuSE installer. The most comfortable way is to format a disk with a single partition for SuSE (with mke2fs -j -I 128 -L openSuSE-Foo /dev/sdaN) and then create a swap file on this partition both to reduce the amount of partitioning needed and alleviate the need for seperate partitions for boot (which overcomplicates matters when multiple installs are used, especially on MBR) and to reduce fragmentation of the swap file.

The required boot line would then be something like

boot hd:0 inst32 install=http://download.opensuse.org/distribution/11.1/repo/oss addswap=file:/swapfile?device=*label/openSuSE-Foo or hd:/swapfile?device=*label/openSuSE-Foo or whatever the thing would be. 

In the use case where a swap file is on a disk where SUSE is installed to (with a custom partition setup and not formatted) then ideally this would be passed into fstab such that it is activated at boot.swap time?

This sort of includes the other bug report of a similar nature, https://bugzilla.novell.com/show_bug.cgi?id=438890 which I am about to mark as a duplicate of this bug.. :]

As a side note I wonder is there any way to pass in a parameter without using AutoYaST to pick the device to install *TO* (possibly allowing some NFS urls to be dropped in) - or an easy way to make an AutoYaST image which can be passed in and somehow allow us to push an installation to an arbitrary partition which has already been formatted..

I know these are quite weird requirements but it makes the installation and testing of systems across our worldwide development team much less full of woe and despair and everyone having a different system setup by way of forgetting to click a button or having a personal preference..?
Comment 7 Arvin Schnell 2008-11-25 09:04:40 UTC
This is a feature request. I already explained in another bugzilla entry that
the use cases for swap files are rather low so I'll not add it to YaST unless
product management wants it (and thus drops other new features).