PDA

View Full Version : swap on a regular file



ddrex
04-07-2005, 11:43 AM
I'm trying to set up swap on a regular file.

I created the file using dd, initialised it with mkswap, and tried to mount it with swapon.

On the 3.8 knoppix, swapon reports simply "invalid argument" and fails.

On the 3.7 knoppix, swapon says the swapfile doesn't have a signature. I checked with od, and sure enough, there is no signature.

Any advice?

Wirf
04-07-2005, 04:35 PM
Where are you trying to make the file?
On a NTFS partition perhaps?
Or maybe on the ramdisk?

I did a quick test on this (Debian sid) machine and it worked OK:



wander:/tmp# dd if=/dev/zero of=./swapfile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes transferred in 0.437670 seconds (239581359 bytes/sec)
wander:/tmp# mkswap ./swapfile
Setting up swapspace version 1, size = 104853 kB
no label, UUID=9dccb944-ed87-465f-bbbe-a37df2517ca8
wander:/tmp# swapon ./swapfile
wander:/tmp# free -m
total used free shared buffers cached
Mem: 1011 966 45 0 72 705
-/+ buffers/cache: 188 823
Swap: 100 0 100
wander:/tmp#


Perhaps this is of any use?