Questions about Swaps

On my triple-boot PC:

SuLinux:~ # fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6260518e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            1917       13665    94373842+   7  HPFS/NTFS
/dev/sda2               1        1916    15390238+   c  W95 FAT32 (LBA)
/dev/sda3   *       13666       30401   134431920    f  W95 Ext'd (LBA)
/dev/sda5           13666       13927     2104483+  82  Linux swap / Solaris
/dev/sda6           13928       16538    20972826   83  Linux
/dev/sda7           16539       26482    79875148+  83  Linux
/dev/sda8           26483       30234    30137908+  83  Linux
/dev/sda9           30235       30401     1341396   82  Linux swap / Solaris

Partition table entries are not in disk order
SuLinux:~ # 

sda 5, 6 & 7 are openSUSE 11.3, sda 8 & 9 are Ubuntu 9.10 (Karmic Koala), and (of course), sda 1 & 2 are Windows/XP.

When I installed 11.3 over 11.2, the installer (apparently) decided to use both sda5 and sda9 for swap partitions.

SuLinux:~ # swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda5                               partition       2104476 6104    -1
/dev/sda9                               partition       1341392 0       -2
SuLinux:~ #

Ubuntu seems to use only sda9 (according to its /etc/fstab. If I were to modify the openSUSE /etc/fstab

# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc	/proc	proc	defaults	0	0
sysfs	/sys	sysfs	noauto	0	0
usbfs	/proc/bus/usb	usbfs	noauto	0	0
devpts	/dev/pts	devpts	mode=0620,gid=5	0	0
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part6	/	ext4	acl,user_xattr	1	1
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part7	/home	ext4	defaults	1	2
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part1 /windows/C      ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part2	/windows/D	vfat	users,gid=users,umask=0002,utf8=true	0	0
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part5	swap	swap	defaults	0	0
/dev/disk/by-id/ata-WDC_WD2500BEVE-00WZT0_WD-WX11A10N3227-part9	swap	swap	defaults	0	0
debugfs	/sys/kernel/debug	debugfs	noauto	0	0

commenting out ("#") the “part9” entry, I assume that sda9 will not be used for swap.

Will the above procedure accomplish this objective, without crippling openSUSE ? The second swap partition has never shown any activity (on SUSE). I understand (from Using shared swap files) that a single swap partition may be shared. Since these areas are relatively small, It is not inconvenient to maintain separate swap partitions.

Comments are appreciated.

You need to explicitly tell the installer what partitions to use as swap if you plan to share.

The procedure you out line looks like it will work. But the you still end up with sda9 a small partition that is now unused.

After changes,

SuLinux:~ # swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda5                               partition       2104476 47580   -1
SuLinux:~ #

Worked as descrbed. My concern was due to never having deleted/commented in /etc/fstab, only modification or addition.

As for the sda9, is is still used by Ubuntu, albeit infrequently. On the next reallocation/repartitioning, I most likely will set up a single shared swap. For the time being, I’ll keep them separate.

Thnks for the assist.

There is no problem with having more than one swap, openSUSE can use either, If you delete sda5 it will use sda9.
You could then use that free space most easily on sda2 or sda6 (although you can use it anywhere, and as an excuse to reassign free space on other partitions).
With a working backup, and a few other precautions, I have not found this either stressful or difficult.

Doesn’t /boot/grub/menu.lst tell the OS which swap file to use? Otherwise default to the open one? Swap files aren’t that important with these new releases and large memory, so, users can create physical files to act as swap files, which to me means much better space allocation and partition usage.

Any chance you could offer advice to noospaper on his topic Making a native partition an extension ? He wants a triple boot Win 7, openSUSE, Ubuntu?

Doesn’t /boot/grub/menu.lst tell the OS which swap file to use?

No /etc/fstab defines the default mount points including swap

True enough thanks. FWIW, I read a grub explanation that states resume is used to recover from hibernation.

On 2010-09-10 22:06, tararpharazon wrote:
> Doesn’t /boot/grub/menu.lst tell the OS which swap file to use?

It tells the kernel which swap partition to attempt recovery from, after hibernation. This is
different from which swap partition(s) to use for swapping, which are specified in fstab.

Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Minas Tirith))

Yes thank you Carlos I noted that in the previous reply.