I've created a swap file with
dd if=/dev/zero of=swap.img bs=1024k count=4k
mkswap swap.img
swapon swap.img
While this works, the swapon
command takes ages (approx 10min) to finish. Enabling the swap file in /etc/fstab
means the boot process will halt for several minutes.
I've noticed the execution time of the dd command will decrease if I increase the block size (tried with 1024 and 1 before). Does this also have an impact on swapon
?
Will swapon
handle sparse files? I've tried successfully before, but got a "swap file has holes" after a reboot, so I switched back to a full file.
Some more info:
- Using Linux Mint KDE 15 RC
- Swap file is on a mounted NTFS partition
Output of dd
was
4096+0 records in
4096+0 records out
4294967296 bytes (4,3 GB) copied, 73,9629 s, 58,1 MB/s
Output of mkswap was
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=108b2e2d-e00a-40d0-8e28-c0b72003e63e
swapon
didn't produce any output, but dmesg
afterwards showed:
Adding 4194272k swap on /host/personal/swap.img. Priority:-1 extents:9 across:4335880k
Any idea how to create a swap file (better even twice the size) that mounts in a reasonable time?
dd
command? That's a huge file, not the 4GB you seem to be expecting.