User Tools

Site Tools


howtos:move-swap

This is a description for Ubuntu Feisty (or at least that is what has been tested). Please also note that I use uswsusp for suspend/hibernation.

Find the new name of the swap partition:

root@dubex-tdd:~# fdisk -l

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *       10029       11552    12241530    7  HPFS/NTFS
/dev/sda2           11553       12161     4883760   12  Compaq diagnostics
Partition 2 does not end on cylinder boundary.
/dev/sda3               1        8751    70292376   83  Linux
/dev/sda4            8753       10028    10249470    5  Extended
/dev/sda5            8753        9767     8152956   83  Linux
/dev/sda6            9768       10028     2096451   82  Linux swap / Solaris

Now change /etc/uswsusp.conf to reflect the changes:

root@dubex-tdd:~# cat /etc/uswsusp.conf 
resume device = /dev/sda6
compress = y
early writeout = y
image size = 487332331
RSA key file = /etc/uswsusp.key
shutdown method = platform

As we use Feisty the fstab file is a little bit out of the ordinary as the partitions are referenced by UUID numbers. Lets start with finding the new UUID number for our swap partition:

root@dubex-tdd:~# blkid
/dev/sda1: TYPE="ntfs" 
/dev/sda2: LABEL="IBM_SERVICE" UUID="1B33-0A00" TYPE="vfat" 
/dev/sda3: UUID="b64cbb80-79e9-4ba0-bdd3-592b9acaa931" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sda5: UUID="f3c04067-62bb-4c86-ad3d-3ee62cf42044" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sda6: UUID="1194f834-8fdf-4b81-b4ec-92d3860f88b5" TYPE="swap" 

or

root@dubex-tdd:~# vol_id /dev/sda6
ID_FS_USAGE=other
ID_FS_TYPE=swap
ID_FS_VERSION=2
ID_FS_UUID=1194f834-8fdf-4b81-b4ec-92d3860f88b5
ID_FS_LABEL=
ID_FS_LABEL_SAFE=

With this information we can now update /etc/fstab:

root@dubex-tdd:~# cat /etc/fstab
 /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda3
UUID=b64cbb80-79e9-4ba0-bdd3-592b9acaa931 /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda1
UUID=221CBFA51CBF7281 /media/sda1     ntfs    defaults,nls=utf8,umask=007,gid=46 0       1
# /dev/sda2
#UUID=1B33-0A00  /media/sda2     vfat    defaults,utf8,umask=007,gid=46 0       1
# /dev/sda4
UUID=1194f834-8fdf-4b81-b4ec-92d3860f88b5 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
none /proc/bus/usb usbfs devgid=1002,devmode=664 0 0

The last thing we need to update is the initram file so the boot process looks at the right location:

root@dubex-tdd:~# update-initramfs -u -k 2.6.20-15-generic

Update: If you want to make an update for all you kernel versions just run:

root@dubex-tdd:~# update-initramfs -u

Update#2: Remember to update the file /etc/initramfs-tools/conf.d/resume to reflect the UUID of the new swap partition before running the update-initramfs.

That should be it!

howtos/move-swap.txt · Last modified: 02/12/2018 21:34 by 127.0.0.1