I have a small embedded linux kernel and file system created via buildroot that is installed onto a compact flash drive running on an x86 board. I am using an initramfs (due to power loss concerns) but mounting a small number of directories on ext3 partitions on the CF drive for data that has to be persistent. However, recently I have been reading about swap partitions and their uses and as my current setup does not employ a swap partition at all. I am wondering if this is safe? I do not anticipate that the applications running on the device will be using a great deal of memory but is it better to create a swap partition regardless? I am very conscious of the limited writes that can be made to CF devices so if it is not vital then I would prefer not to use a swap partition. What would be the worst case scenario if I go ahead without a swap partition?


No, this is not a bad idea. Many devices that you may find around are running linux without swap partition. For example, there are many DLink router models with linux inside. The only possible issue is that it may run out of memory. However, with embedded solutions this should not happen if the system is properly designed (no memory leaks, e.t.c.) and user is not allowed to start any extra programs on his own.


You should configure memory so the normal workload fits in it (disk is much, much slower than memory). Embedded devices, by their very definition of running a limited, fixed workload, have very predictable memory requirements. So it doesn't make sense to add swap.


It's actually recommended. Having a swap partition on flash would wear it off (flash has a couple of 100k of write cycles).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.