Live distro question Is there an NTFS equivalent for mkdosswap?

Forum: LinuxTotal Replies: 5
Author Content
BernardSwiss

Nov 24, 2012
3:56 AM EDT
I've been playing around a bit with Live distros on USB sticks, lately, and realized that the old trick of putting a swap-file on your Windows harddrive is no longer viable, because Windows no longer runs on top of a GOS filesystem, but on NTFS instead.

I did figure out that one could format the USB stick with a swap partition, and then enable that once booted (though the laptop I was using had more than enough RAM so I didn't see how much difference it actually could make. And I'm not sure the USB swap would be faster than a swap-file on disk (I'm presuming slower, with a SATA disk and USB 2).

And of course this approach would be no use when running a live-distro from a CD/DVD and no USB stick handy. The other laptop I have access to has only USB v1, so it wouldn't benefit from USB swap -- and would need some sort of swap a lot more.

Is the swap-file trick history, now? Is there something else one can do?
HoTMetaL

Nov 24, 2012
10:37 PM EDT
I can't answer your question, but I have to ask: why would you want/need a swap partition in live mode?
BernardSwiss

Nov 24, 2012
11:57 PM EDT
> ... why would you want/need a swap partition in live mode?

Well...

Because you don't have loads of RAM. *** And you don't have separate Linux swap partition. *** And the system is running slow as a result (or just falls over with no warning). *** And you can't repartition to make a standard Linux swap partition (eg. It's not your computer -- maybe you're demo-ing a Linux live distro).

If you have plenty of RAM you're fine, but if you have only a little, the system is liable to run slow, or even freeze or crash when the RAM runs out (how much RAM is "enough" depends on the distro and on what you are doing.

When I first tried out a live distro (Knoppix, IIRC) it was recommended that, if you could then you should, make a swap-file on your Windows hard-drive (ie. DOS filesystem).

The easy way to do this was to use mkdosswap utility. Then you would enable swap and generally see a quite noticeable improvement in performance.

jdixon

Nov 25, 2012
2:25 AM EDT
> ...Is the swap-file trick history, now? Is there something else one can do?

Won't the ntfs-3g drivers support a swap file on an NTFS partition? I would think they would, as the only requirements should be to be able to read and write to the file.

OK, the nfts-3g faq has a entry on the matter at http://www.tuxera.com/community/ntfs-3g-faq/#swap

"Can I use swap file safely, deadlock free on NTFS?

Yes, this is possible if it’s properly setup. Below is the example how to create, initialize and turn on a 2 GB swap file safely, deadlock free: dd if=/dev/zero of=swapfile bs=1M count=2000 mkswap swapfile swapon swapfile You must turn off the swap file with ‘swapoff’ before you would be able to unmount NTFS. Please also note that other solutions, for example using swap on a loop device, are not safe and can cause deadlock!"

Assuming this information is still current, of course.
BernardSwiss

Nov 25, 2012
4:15 AM EDT
@jdixon

> Assuming this information is still current, of course.

Wouldn't the instructions as given would create a swap file on whatever Linux directory one issued those commands from, rather than on an NTFS partition (assuming one isn't running Linux on an NTFS filesystem)? I guess they're more a hint than a how-to.

- - -

I keep reading that using dd to write to NTFS is a no-no. Is my info out of date? (I wouldn't be surprised).

That would appear to mean that one can now safely use dd to write to ntfs partitions/file-systems. I seem to be finding some relatively recent Puppy references that could support this -- at least they don't warn about dd-ing to NTFS. (eg. http://www.linuxquestions.org/questions/linux-newbie-8/what-... ).

Aside from that, it looks (as best as I can recall) pretty much how it was done before, when Windows ran on a DOS/FAT file-system).

I think someone gave me an unused XP disk -- maybe when I get that test-box put together I can experiment.
jdixon

Nov 25, 2012
11:53 AM EDT
> I keep reading that using dd to write to NTFS is a no-no. Is my info out of date? (I wouldn't be surprised).

Get the contig program from the System Internals suite and use it to create the swap file under Windows.

You cannot post until you login.