how do I make a linux swap file?

Booting, installing, newbie
Post Reply
Message
Author
User avatar
pooklaroux
Posts: 60
Joined: Wed 15 Mar 2006, 07:09
Location: Columbus, Ohio

how do I make a linux swap file?

#1 Post by pooklaroux »

I used cfdisk to partition my hd, and right now, I have two partitions, a bootable 10g fat 32, and a 1 g linux swap, but when puppy boots, it tells me that it can't use hda2. What did I do wrong? How can I fix this?

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Are Wiki swapfile instructions OK on FAT32 drive?

#2 Post by Sit Heel Speak »

I too have a question concerning creation of a swapfile. Perhaps the answer(s) will aid the above questioner.

I feel expert enough in Puppy now ( :lol: ) to raise the size of pup100 on my USB flash drive up to where it's large enough to accommodate both Open Office 2.x and Wine. Based on NathanF's Wine HowTo instructions I plan to enlarge pup100 to size 768MB.

Since I have only 256MB of RAM, I presume I am going to need a swapfile.

Instructions are given at

http://puppylinux.org/wikka/SwapFile

for creating a swapfile on the same partition as pup001 is on, but that isn't what I want to do. I want to put the swapfile not on my USB flash drive (which is the partition where pupxxx, in this case pup100, resides) but rather on my hard disk.

Transforming the instructions from the above-named Wiki article, it would seem that what I want to input into rxvt to create a 1GB swapfile on my hard disk (after defrag'ing it in Windows, of course) would be:

dd if=/dev/zero of=/mnt/hda1/puppy.swp bs=1024 count=1000k

and then wait for the command to complete, and then

mkswap /mnt/hda1/puppy.swp
swapon /mnt/hda1/puppy.swp

and then edit /root/.etc/rc.d/rc.local to add the line at the bottom:

swapon /mnt/hda1/puppy.swp

Ah, but I can foresee possible problems:

1. My hard disk is now partitioned (by Win98SE fdisk) as a single FAT32 partition. Will the above procedure work to create the swapfile puppy.swp in the disk's topmost (C:\, to Windows) directory, which Puppy can then find and use when booted from floppy and run from the USB flash drive?

2. If the answer to #1 is "Yes it will work," then my next question is, will there be an issue concerning the order in which the drive is mounted and rc.local is executed? I have run Sunburnt's auto-mount-at-boot program xbootmount, instructing Puppy to automount the hard disk at boot, and it does so every time I boot. Assuming the answer to Question #1 is Yes, will Puppy attempt to mount and use my swapfile-on-hard-disk before xbootmount (or whatever config file it modified) takes effect and mounts hda1? Or is Puppy smart enough to auto-mount hda1 _before_ doing anything about a swapfile?

3. If it turns out that I must shrink the existing hard disk's now-single partition and allocate what remains as a new, second partition, specified to be a Linux swap partition, then might I inquire what the best partition management software is for the task?

Sit

"There are 10 kinds of people in this world: those who understand binary, and those who don't."
Last edited by Sit Heel Speak on Mon 10 Apr 2006, 21:23, edited 1 time in total.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#3 Post by Flash »

Here is a thread that might answer your question. There you will find a link to this website that discusses swap files.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#4 Post by Sit Heel Speak »

Pook: you might take a look at

http://www.murga.org/~puppy/viewtopic.php?t=7230

and

http://www.murga.org/~puppy/viewtopic.php?t=6868

and, supply us with more details about your computer and how you are attempting to boot Puppy. In another thread you say it is a Thinkpad, but not what type. My machine, for example, is also a Thinkpad, type T21. I don't have the rewriteable Hitachi CD/DVD burner for it, and my hard disk already holds a Win98SE installation, so I have been loading Puppy onto a USB flash drive and booting from floppy using WakeUSB. This option has, so far, allowed me to boot Puppy without putting anything onto my hard disk. My question, now, concerns what do I do for a swapfile now that I want to make the pupfile on my USB flash drive larger. I believe that the answer to my question may help you as well, since we both have Thinkpads and both have questions concerning the hard disk and the boot process.

Flash: I can't use pupswap in its present form. It creates the swapfile only in / (the ramdrive :evil: ) or in /mnt/home (my USB flash drive :x ). I want it on my hard disk (/mnt/hda1, after xbootmount).

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#5 Post by GuestToo »

1) yes, that should work

2) yes, /mnt/hda1 needs to be mounted before creating or mounting a swapfile in that partition

i don't know anything about Sunburnt's xbootmount ... i don't know when it executes

something like this in rc.local would allow Puppy to use a swapfile in /mnt/hda1:

mkdir /mnt/hda1
mount -t vfat /dev/hda1 /mnt/hda1
swapon /mnt/hda1/puppy.swp

assuming that the file puppy.swp has already been created and formatted

you probably do not need to repartition your drives

fstab might be editable in Puppy 2, which might be a more flexible method of mounting drives

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#6 Post by Flash »

Sorry, I'm afraid I didn't read the original posts before I shot my mouth off. :oops:

Pook, a swap file does the same thing as a swap partition, but there is a slight difference between the two. A swap file is, as the name implies, a file within a filesystem as defined by a partition. You created a swap partition with cfdisk, not a swap file within a partition. Puppy should see that swap partition when it boots and automagically use it if it needs to. Swap memory is only used to hold the overflow when there isn't enough RAM to hold everything related to the programs (processes) that are running. From the error message you report, it doesn't seem to me that Puppy's problem is with the swap memory at all. What is the exact error message Puppy gives you when it boots?

User avatar
klhrevolutionist
Posts: 1121
Joined: Wed 08 Jun 2005, 10:09

swapfile

#7 Post by klhrevolutionist »

I created a dotpup so that it would be easier for NooBEES to create swapfiles.
It however creates the swapfile in /mnt/home/ So if you have a fat32 or an nfts partition mounted beware......

http://www.murga.org/~puppy/viewtopic.p ... 4280+drive
Heaven is on the way, until then let's get the truth out!

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#8 Post by Sit Heel Speak »

GuestToo wrote:...1) yes, that should work...
Thank you, GuestToo. Your advice is always refreshing.

Post Reply