PDA

View Full Version : [all variants] Swap partition - need to activate a second one



gecko3940
December 31st, 2008, 01:18 AM
I have created on a USB external hard drive a second swap partition but have been unable to have it load/activate at bootup.

My existing swap partition is rather small at around 600MB and is located on my internal hard drive at sda5. Windows, Ubuntu and a Document partition are also on that drive. Here is my fstab file:


proc /proc proc defaults 0 0
# Entry for /dev/sda2 :
UUID=9c3e70a0-74a8-428a-abaa-1e46032cffa5 / ext3 relatime,errors=remount-ro 0 1
# Entry for /dev/sda5 :
UUID=2ae4939e-33b1-45d1-8f13-91f313366ab9 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda3 /media/Documents ntfs-3g defaults,locale=en_AU.UTF-8 0 0
/dev/sda1 /media/Other ntfs-3g defaults,locale=en_AU.UTF-8 0 0

I have tried adding the following to no avail:


/dev/sdc1 none swap sw 0 0

and then tried this to no avail (the UUID obtained via blkid command):


# Entry for /dev/sdc1 :
UUID=85834861-6113-47e5-babc-6aee239a71b8 none swap sw 0 0

I can load the USB swap partition manually with a swapon command.

Thanks in advance for any help in getting this swap partition activated. By the way, I've set it at 1 GB.

taurus
December 31st, 2008, 01:20 AM
What are the outputs of these commands from a terminal?


sudo fdisk -l
sudo blkid
cat /etc/fstab
free -m

gecko3940
December 31st, 2008, 02:05 AM
fdisk -l:


Disk /dev/sda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x92479247

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2075 16667406 7 HPFS/NTFS
/dev/sda2 2076 4150 16667437+ 83 Linux
/dev/sda3 4227 7297 24667807+ 7 HPFS/NTFS
/dev/sda4 4151 4226 610470 5 Extended
/dev/sda5 4151 4226 610438+ 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0009636d

Device Boot Start End Blocks Id System
/dev/sdc1 1 128 1028128+ 82 Linux swap / Solaris
/dev/sdc2 129 19457 155260192+ 83 Linux

blkid:


/dev/sda1: UUID="2EA002CAA002988B" TYPE="ntfs"
/dev/sda2: UUID="9c3e70a0-74a8-428a-abaa-1e46032cffa5" TYPE="ext3"
/dev/sda3: UUID="2BE20CA4189799AC" TYPE="ntfs"
/dev/sda5: TYPE="swap" UUID="2ae4939e-33b1-45d1-8f13-91f313366ab9"
/dev/sdc1: TYPE="swap" UUID="85834861-6113-47e5-babc-6aee239a71b8"
/dev/sdc2: UUID="b517f302-8519-4e15-a1f8-d4eb121aa616" TYPE="ext3"


cat /etc/fstab:


# -- This file has been automaticly generated by ntfs-config --
#
# <file system> <mount point> <type> <options> <dump> <pass>

proc /proc proc defaults 0 0
# Entry for /dev/sda2 :
UUID=9c3e70a0-74a8-428a-abaa-1e46032cffa5 / ext3 relatime,errors=remount-ro 0 1
# Entry for /dev/sda5 :
UUID=2ae4939e-33b1-45d1-8f13-91f313366ab9 none swap sw,pri=3 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda3 /media/Documents ntfs-3g defaults,locale=en_AU.UTF-8 0 0
/dev/sda1 /media/Other ntfs-3g defaults,locale=en_AU.UTF-8 0 0
/dev/sdc1 none swap sw,pri=3 0 0

.. the /dev/sdc1 and pri=3 entries were added by me to load the USB swap (at /dev/sdc1) and give it equal priority to the original swap (at /dev/sda5). Still didn't work.

free -m (ignore the fullstops):



................... total .. used .. free .. shared .. buffers .. cached
...........Mem: 756 ... 746 . ... 10 ....... 0 ....... 17 ....... 393
-/+ buffers/cache: .. 335 ... 420
..........Swap: . 596 .... 0 .... 596

albinootje
December 31st, 2008, 02:10 AM
My existing swap partition is rather small at around 600MB and is located on my internal hard drive at sda5. Windows, Ubuntu and a Document partition are also on that drive.

To me it looks like you really don't need more swap space.
Or am I wrong ? Are you using a lot of heavy RAM eating programs ?

taurus
December 31st, 2008, 02:25 AM
What if you edit /etc/fstab and replace the current /dev/sdc1 in there with this one?


UUID=85834861-6113-47e5-babc-6aee239a71b8 none swap sw 0 0
Save it and then run


sudo mount -a
free -m

gecko3940
January 4th, 2009, 04:05 AM
I'm afraid that hasn't helped. I used exactly that line to no avail, and then tried adding a line above it: "# Entry for /dev/sdc1 :", still not working.
Any other suggestions?

taurus
January 4th, 2009, 05:16 AM
From a terminal, run


sudo mkswap /dev/sdc1
Then, edit /etc/fstab and add this line to the end of it.


/dev/sdc1 none swap sw 0 0
Save it and then run


sudo mount -a
free -m

gecko3940
January 14th, 2009, 02:47 AM
Thanks Taurus. I did just that but Ubuntu still only shows the one (original) swap partition. Any other ideas?

albinootje
January 14th, 2009, 04:24 AM
Thanks Taurus. I did just that but Ubuntu still only shows the one (original) swap partition. Any other ideas?

Can you please post the output of the following ?


sudo blkid
sudo swapoff -a
sudo swapon -v -a
free -m

gecko3940
January 14th, 2009, 07:34 AM
everyone@Everyone:~$ sudo blkid
/dev/sda1: UUID="2EA002CAA002988B" TYPE="ntfs"
/dev/sda2: UUID="9c3e70a0-74a8-428a-abaa-1e46032cffa5" TYPE="ext3"
/dev/sda3: UUID="2BE20CA4189799AC" TYPE="ntfs"
/dev/sda5: TYPE="swap" UUID="2ae4939e-33b1-45d1-8f13-91f313366ab9"
/dev/sdc2: UUID="b517f302-8519-4e15-a1f8-d4eb121aa616" TYPE="ext3"
/dev/sdc1: TYPE="swap" UUID="d2c3f3a8-74ee-481b-aeb1-74ee9c5752d5"
everyone@Everyone:~$ sudo swapoff -a
everyone@Everyone:~$ sudo swapon -v -a
swapon on /dev/sda5
swapon on /dev/sdc1
everyone@Everyone:~$ free -m
.................. total used free shared buffers cached
........Mem: 1010 . 992 . 18 .. 0 .... 31 .... 512
-/+ buffers/cache: 448 .. 562
........Swap: 1600 .. 0 .. 1600

Hey, I've now got both swaps working, thanks. How do I keep it this way?

albinootje
January 14th, 2009, 01:10 PM
Hey, I've now got both swaps working, thanks. How do I keep it this way?

Can you please post the output of your /etc/fstab ?

gecko3940
January 15th, 2009, 09:56 AM
The last line I have put in since starting this thread (based on recommendations in this thread):
cat /etc/fstab:


# /etc/fstab: static file system information.
#
# -- This file has been automaticly generated by ntfs-config --
#
# <file system> <mount point> <type> <options> <dump> <pass>

proc /proc proc defaults 0 0
# Entry for /dev/sda2 :
UUID=9c3e70a0-74a8-428a-abaa-1e46032cffa5 / ext3 relatime,errors=remount-ro 0 1
# Entry for /dev/sda5 :
UUID=2ae4939e-33b1-45d1-8f13-91f313366ab9 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda3 /media/Documents ntfs-3g defaults,locale=en_AU.UTF-8 0 0
/dev/sda1 /media/Other ntfs-3g defaults,locale=en_AU.UTF-8 0 0
/dev/sdc1 none swap sw 0 0

albinootje
January 15th, 2009, 03:05 PM
The last line I have put in since starting this thread (based on recommendations in this thread):
cat /etc/fstab:

Weird..
Can you add this to /etc/rc.local and reboot after that ?


swapon -a

gecko3940
January 18th, 2009, 08:04 PM
Thanks albinootje. Do you mean that I enter
swapon -a on the line underneath this one?
exit 0
Will I still be able to boot properly? I don't know what this file does.

albinootje
January 18th, 2009, 08:51 PM
Thanks albinootje. Do you mean that I enter on the line underneath this one?
Will I still be able to boot properly? I don't know what this file does.

the line


exit 0

needs to stay the last line of that file!
So put the line with :


swapon -a

before the "exit 0" line.

/etc/rc.local is the last file of the booting process which is being executed.
As long as you edit that file correctly your computer should boot fine.

caljohnsmith
January 18th, 2009, 10:27 PM
This is just an idea, but it sounds to me like the problem could be that all your initrd images still use the old swap partition UUID. How about doing:

gksudo gedit /etc/initramfs-tools/conf.d/resume
Probably that file will have the UUID of your old swap partition unless you have all ready changed it, so if it does have wrong UUID, replace it with your new swap partition UUID. Next try:

sudo update-initramfs -u -k all
Reboot, and I think that might be all it takes to get your new swap partition working. Let us know how it goes or if you run into problems still.

gecko3940
January 22nd, 2009, 10:23 AM
Thank you albinootje and caljohnsmith. I tried the swapon -a into /etc/rc.local method first, and on reboot my system monitor says I have 1.6 GB swap space. So it has worked. :D

gecko3940
February 4th, 2009, 06:19 AM
Update: lately the 2nd swap partition hasnt been loading. So back to around 600mb of swap space again. I'm interested in doing what caljohnsmith suggested 2 posts ago:


How about doing:
Code:

gksudo gedit /etc/initramfs-tools/conf.d/resume

Probably that file will have the UUID of your old swap partition unless you have all ready changed it, so if it does have wrong UUID, replace it with your new swap partition UUID. Next try:
Code:

sudo update-initramfs -u -k all

Reboot, and I think that might be all it takes to get your new swap partition working. Let us know how it goes or if you run into problems still.

But as I'm trying to get TWO swap partitions running, I'm not sure what to enter. Any ideas??

caljohnsmith
February 4th, 2009, 03:44 PM
I apologize because I realized I misunderstood you in my previous post; I didn't know you actually wanted two swap partitions instead of one. Please ignore my previous post. After reading over your posts more carefully, I think the issue might be be a timing issue; maybe your USB drive does not become available to the kernel by the time your fstab is executed or the rc.local file is executed, or something along those lines. How about in your rc.local file where you have "swapon -a", change that to:

{ sleep 20; swapon -a; } &
That will add a 20 second delay before the "swapon" command is executed. Let me know if that helps. If it doesn't, please post:

free
cat /etc/fstab
cat /etc/initramfs-tools/conf.d/resume
sudo blkid -c /dev/null
cat /etc/rc.local
And we can work from there if you want.

gecko3940
February 20th, 2009, 08:05 PM
Thanks for the replies. It didnt work. I figured I'd spent enough time on this. I removed the 2nd swap partition and made a swap file within ubuntu's partition. That works (tho i have 2 swap spaces now). I dont hibernate anyway as it doesnt work well with dual boot systems..

Interestingly, when I used the live cd (for repartitioning), my 2nd swap partition was working! :confused: