It’s just data

Memory is Fungible

Robert Love: No hard drive means no swap file [via Tim Bray]

I don’t follow.  I don’t have a hard drive on my 4GB EEE netbook, yet I have a swap file:

Disk /dev/sda: 4034 MB, 4034838528 bytes
255 heads, 63 sectors/track, 490 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x892d892d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         461     3702951   83  Linux
/dev/sda2             462         490      232942+   5  Extended
/dev/sda5             462         490      232911   82  Linux swap / Solaris

I see no reason why a 16GB iPod couldn’t have a swap file.


I have a 100 GB OWC SSD in my MacBook Pro, and still have a swap file:

-rw------T  1 root  wheel  4294967296 Apr  6 11:57 sleepimage
-rw-------  1 root  wheel  67108864 Apr  6 12:03 swapfile0
-rw-------  1 root  wheel  67108864 Apr  6 12:03 swapfile1
-rw-------  1 root  wheel  134217728 Apr  6 12:03 swapfile2
-rw-------  1 root  wheel  268435456 Apr  6 12:03 swapfile3
-rw-------  1 root  wheel  536870912 Apr  6 12:03 swapfile4
-rw-------  1 root  wheel  1073741824 Apr  6 12:03 swapfile5

In fact, I have six of them!

Posted by Guan Yang at

Sam, the SSD is — as far as your computer is concerned — a hard drive. Furthermore — and that’s the big difference — SSD controllers usually handle wear leverage (that’s one of their big jobs), straight flash access (aka mobile device) is usually implemented without wear leverage because of both the complexity and the need to set aside flash capacity for the buffer zone. And since the swap file would be fixed-size, it would keep using the same sectors over and over again, annihilating them extremely fast. That’s why even on Android phones, by default you can only put swap files on SD cards: SD cards are expandable, when they wear out you can throw them out and get new ones. Not so with central memory, once it’s dead you’re done.

Posted by Masklinn at

Oh, and the sd part of sda is for SCSI, it’s related to drivers and access method, not whether the drive is an HDD or an SSD. Indeed, get and SCSI controller and a 15000RPM HDD for it, and you’ll see it as an sd drive, not hd.

The hd part of hda merely means it’s an IDE drive, put an SSD drive behind an IDE controller (for whatever reason) and you’ll get an hda device which is not an HDD.

Posted by masklinn at

As others have stated here your SSD is your hard drive and part of it is for swap.  But even if this was a disk-less client being booted off the network it could use a portion of RAM for pseudo swap.  In fact HP-UX uses RAM for psudeo swap even when there is plenty of disk space because RAM is faster than HDD and is no longer scarce.

Posted by Will Sterling at

I’m sure Apple is using wear leveling in iPhone OS (they even have an analog of TRIM).

I have swap in my Nokia N900 and it totally sucks; it’s not uncommon for the phone to lock up for an entire minute.

Posted by Wes Felter at

the SSD is — as far as your computer is concerned — a hard drive

That’s exactly my point.

I’m sure Apple is using wear leveling in iPhone OS

If they don’t I would be curious as to why not.

it’s not uncommon for the phone to lock up for an entire minute

And yet my EEE can run Ubuntu NetBookRemix just fine.  I’m not suggesting that an iPad should be able to run Eclipse and Photoshop at the same time, but being able to keep an IM application running while doing other work would be handy.

Posted by Sam Ruby at

Does the iPad have a swap file?

Tim said “something like Lightroom could be made to run acceptably on the kind of 1Ghz-or-so processor the iPad has, but never, I’m pretty sure, with only 256M of RAM and no swap.”

He said nothing about the ability of the iPad device to use the drive to host swap files; rather, I’m sure he looked at the iPad’s OS’s stats and noted that it doesn’t use a swap, most likely for the speed bonuses. Besides, with no multitasking, it wouldn’t need it.

If you hacked an iPad to run Linux, it would most likely use a swap file.

Posted by Michael Kozakewich at

Or wait a minute. In the hours it took me to reply (I’m on a flaky connection), I forgot what you quoted and zeroed in on that link to Bray. I think I got all excited when you linked to him.

The first thing I think when someone says something about a ‘hard drive’, with those exact two words, is that they’re talking about a drive in general, rather than a hard-disk drive. In that sense, his claim would make no sense at all, because the iPad does come with a drive.
On the other hand, yeah, “no hard-disk drive means no swap file” is completely false. So Robert is wrong all around. My SSD-using netbook is using 600MB of swap file, right now.

Posted by Michael Kozakewich at

I wouldn’t recommend swapping to a first gen EeePC’s SSD. Those first gen SSDs were very cheap (their write speed is atrocious for example) and the rumour mill says that using them for swap is a good way to reduce their life because they are. Once upon a time Linux kernel hacker Dave Jones had more to say about this. Obviously this warning doesn’t apply to people using expensive Intel SSDs etc.

There is a recent feature called compcache/ramzswap that uses compressed RAM as swap which is an interesting idea.

Posted by Anon at

Memory is not yet fungible for mobile phones. First Generation iPhones and Android devices just have 128 MB RAM (256 flash), going up to 256M RAM for second gen, and now the first models with 512M are out (Nexus One, 512 RAM/512 flash). Secondary flash storage is slow for writes. In addition, SD cards are removable, so no permanent swap file makes sense.

It is under those design constraints that Robert Love words have to be understood. We are about to have devices that can start lifting those constraints. 128M is not comparable, even for 2/3 multitasking programs, with 1G.

Posted by Santiago Gala at

Add your comment