PDA

View Full Version : Swap partition not being used on boot-up



palaste
30th January 2008, 10:56 PM
I have a ~16 GiB extended partition on my hard drive consisting entirely of a Linux swap partition. However, when the system boots up, it recognises it but doesn't use it as swap. If I run GPartEd, and manually select "SwapOn" for that partition, it can be used as swap. Otherwise, Linux thinks I have 0 bytes of swap. How can I make Linux automatically use the partition as swap on boot-up?
I can supply the content of all necessary files upon asking.

markkuk
30th January 2008, 11:16 PM
You must add a line to the /etc/fstab file to automatically use the swap partition. See "man 5 fstab" for instructions.

amanadas
31st January 2008, 01:25 AM
Hi,

Post the "fdisk -l" and "cat /etc/fstab" command results.

palaste
31st January 2008, 07:12 AM
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0002a51e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 26133 209712510 83 Linux
/dev/sda3 26134 36576 83883397+ 83 Linux
/dev/sda4 36577 38913 18771952+ 5 Extended
/dev/sda5 36577 38913 18771921 82 Linux swap / Solaris

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x12345678

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 38913 312568641 c W95 FAT32 (LBA)

LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
LABEL=/boot1 /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda5 swap swap defaults 0 0
/dev/sdb1 /lacie ext3 user 0 0
/dev/sdc1 /usbdisk auto user 0 0
/dev/cdrom /cdrom auto user 0 0

This is when the swap partition has been manually enabled from GPartEd.

amanadas
31st January 2008, 11:13 PM
The system is seeking a partition in any disk that has a label SWAP-sda5 to use as swap, you just have to guarantee that your swap partition in sda5 has that label, just do "mkswap -L SWAP-sda5 /dev/sda5". Next time you boot it will be recognized.