Quote:
Swap file creation on an existing partition also works, but takes a long time. But it still makes life a lot more easy.
Surely there is a way to create a file of a certain size rather than use dd or some other tool to create a large file?
In tests when we first discussed this, making a 300MB swap file took 8 minutes. I don't think 1024MB would be a pleasant experience.
For instance I can do this in Windows XP:
Code:
fsutil file createnew c:\myswapfile.swap 1000000000
Under AmigaOS or MorphOS there are tools which simply use the system function dos.library/SetFileSize()
I'm guessing ftruncate or truncate would do the job here for Linux;
Code:
#include <unistd.h>
int main()
{
truncate("path to swap file", big_value);
}
I just tested it and it works fine; I got a 1MB, 500MB and 1024MB file instantly.