How to use a hard drive for a Swap Partition

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
kethd
Posts: 451
Joined: Thu 20 Oct 2005, 12:54
Location: Boston MA USA

How to use a hard drive for a Swap Partition

#1 Post by kethd »

How to dedicate a small hard drive (270MB) to Swap Space for Puppy:

* Connect to IDE Secondary Master.

* (Zero or Wipe it if you wish, using dd or other tools)

* Boot Puppy.

* Use fdisk or cfdisk to make a Linux Swap Partition (type 82).

* From the command line:
mkswap /dev/hdc1
swapon /dev/hdc1

You are done. You can see the fruits of your labor with the command:
# free

Now that you have gotten all this working manually, if you are using a standard sort of Puppy, it seems to look for and start using this swap space automatically each time you boot.

But if you are using a more traditional sort of Linux installation (Puppy HDoption-2 install), you will either have to start your swap manually each session:
swapon /dev/hdc1
or figure out how to add that setting to your boot sequence.

Further info:
http://www.murga.org/%7Epuppy/viewtopic.php?t=4135
http://www.lissot.net/partition/partition-08.html
http://www.xenotime.net/linux/doc/swap-mini-howto.txt
http://www.faqs.org/docs/Linux-mini/Swap-Space.html

What is Swap space?
Using external storage as a virtual extension of internal ram memory. A slow way to pretend that you have more memory than you really do.

Will this make my computer faster?
Generally, it would be more logical for it to make your computer slower! If you can get the job done without using swap, your computer should run faster. But some tasks (having many big programs open at once, or doing heavy-duty program development compilation) might require either swap space or giant impractical amounts of memory.

noip
Posts: 93
Joined: Fri 07 Oct 2005, 00:45
Location: Sydney

#2 Post by noip »

k,

Add the swap partition to /etc/fstab .. assuming type 2 HD install like a conventional distro ...

Here's my Puppy fstab file - and no I don't know EXACTLY what all the options are - copied from successful models mainly. However, line 2 shows what I did with the swap partition. Note that the tabs I used to line the fields up have degenerated to spaces ...

/dev/hdb10 / ext2 defaults 0 1
/dev/hda3 none swap sw 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=2,mode=620 0 0
/dev/hda1 /mnt/C vfat rw,nosuid,nodev,noexec,nouser,async,umask=0 0 0
/dev/hda6 /mnt/D vfat rw,nosuid,nodev,noexec,nouser,async,umask=0 0 0
/dev/hdb12 /mnt/E vfat rw,nosuid,nodev,noexec,nouser,async,umask=0 0 0
/dev/hdb13 /mnt/F vfat rw,nosuid,nodev,noexec,nouser,async,umask=0 0 0
/dev/hda5 /mnt/debian ext3 defaults 0 2
/dev/hdb9 /mnt/slack ext3 defaults 0 2
/dev/fd0 /mnt/floppy auto noauto,user,rw 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0



Rgds

GS

ftgs

muskrat
Posts: 24
Joined: Sun 03 Jul 2005, 17:46
Location: Gulf Coast TX-MX
Contact:

#3 Post by muskrat »

I have a HD with a swap partion, but Puppy doesn't do swapon automaticly at boot. It's in my fstab file and using a midia utility I can do swapon, but I have to do it each time.

I'm running 300 and some odd Mgs Ram, so it's a nothing really. I would just like it to do a swapon at boot. So my question is where and how to I edit my boot sequence to do a swapon at each boot?

I'm running 1.0.7 miltisession CD using a HD partion for my pup002 file. Will I need to burn another CD?
Steve (Muskrat) McMullen
http://www.muskratsweb.com
Registered Linux User #305785

Guest

#4 Post by Guest »

open file /etc/rc.d/rc.local and add line "swapon /dev/hda2".

Of course change hda2 to wherever your swap partition is.

muskrat
Posts: 24
Joined: Sun 03 Jul 2005, 17:46
Location: Gulf Coast TX-MX
Contact:

#5 Post by muskrat »

Thanks for the help, i'll look into that /etc/rc.d/rc.local and see what's there. But I believe I was misstaken, I was looking at MUT and seeing a button that said swapoff, and thinking it was stating the condition of my system, It wasn't it was stating that if I pushed the button it would turn the swapoff, meaning swap was on allready.
Steve (Muskrat) McMullen
http://www.muskratsweb.com
Registered Linux User #305785

wilcal
Posts: 14
Joined: Thu 26 Jan 2006, 18:36
Location: San Diego, CA

#6 Post by wilcal »

I have found that many/most Distros have issues with
recognizing a Linux swap partitions. The most
successful process I have found and use all the time,
although convoluted, is as follows:

Use Killdisk:

http://www.killdisk.com/

and wipe the HD drive completely to zeros end to end.
This program puts your HD back to the identical
condition as it was when it was shipped from the
factory. Give it time. Some slower drives can take
an hour(s) to wipe clean. Even the MBR space will
be wiped to zeros.

I then use the

Ranish Partition Manager

http://www.ranish.com/part/

to examine the drive for the structure of the
drive I want to put the Swap partition on. Lets
use one I'm tinkering with right now. It's a 6.5GB
drive on an older Dell Laptop. This thing only has
64MB of DRAM so a prodigious Linux Swap Partition
would do it well.

I split the drive into two ext3 partitions. One
about 500MB and the other right at 6GB. Once I
have established these two partitions I delete
the first partition ( 500MB ). Basically marking
the space of the first partition as Unused.

I then boot from the CD-1 of the Mandriva 2006
intall CD's. I then proceed to the custom partition
manage section of the Mandriva intall. Mandriva
presents a very nicely laid out GUI partition
manager. What it shows is the MBR, 500MB of unused
space then the 6GB of ext3. I then select the unused
space and designate all of that space, 500MB, as
Linux Swap space. I then let the Mandriva install
program write the MBR and let it format all that.
It only takes a second or so.

I then boot back to a simple floppy running anything.
The HD now has a real Linux Swap partition created by
a major Linux Distro.

At this point I put in my Puppy Linux Live-CD and
reboot the machine. Puppy REALLY laps up this swap
partition seeing the entire 500MB as usable SWAP DRAM
and loads its self entirely to the swap space.

The now doggedly slow laptop with the anemic 64MB DRAM
becomes a champion canine and runs all the Puppy apps
lighting fast. What's interesting is that this same
laptop running WinBlows XP takes almost 10 minutes
to boot to a working desktop with XP installed on
it's HD. With Puppy booting from a Live-CD and this
big Swap partition Puppy boots to a usable desktop
in a couple minutes tops.
"DISK BOOT FAILURE - INSERT SYSTEM DISK AND PRESS ENTER"
is my friend

Post Reply