1

I would like to install a Linux system on a SD card. My idea is to have / (and possibly /boot) on a SD card and /home on a hard drive. This is for a small home server to be used for some torrenting, data backup, and video/music streaming, so I don't expect the workload to be heavy or continuous (except for torrenting, but I don't expect more than 5 torrents active at any given time).

I know it can be done, but I can't understand is whether it is a good idea to do it. I have found contrasting opinions on forums/blogs. Some people think it will destroy the SD card very quickly, others think it is okay as long as there is no swap and/or no journaling, others again say it is absolutely fine.

Anybody got experiences/thoughts about this?

EDIT: by "safe" and "good idea" I mean that the system is going to be stable and usable. If it is too slow or crash frequently or the SD card would likely fail in a short period of time, then I would conclude it is not a good setup.

2
  • 6
    The Raspberry Pi often has its OS on a microSD card. Whether it's a "good idea" seems subjective and likely unanswerable in a meaningful way. Commented Dec 19, 2021 at 16:57
  • It might be there is special precautions taken in the Rasp-images/setup w.r.t. this.
    – Hannu
    Commented Dec 19, 2021 at 19:05

4 Answers 4

3

Assuming the motherboard supports booting an OS from an SD card, the issue is going to be that SD cards do not support wear-leveling, which will lead to loss of data for a normal OS installation. Most would consider this "not safe".

The way others make this work is to install Linux such that it runs from a "RAM" disk with very infrequent writes to the SD card. These can potentially last as long as an SSD, with the obvious limitations of increased memory requirements and no drive cache.

2
  • "The way others make this work ..." -- Embedded Linux can be booted from SD card but have no swapping. FYI RAM disk use (i.e. initrd) is deprecated in Linux in favor of initramfs.
    – sawdust
    Commented Dec 20, 2021 at 4:17
  • Is this what the RaspberryOS does?
    – point618
    Commented Dec 20, 2021 at 10:31
5

'Safe' in what way?
It will be slow as all heck & liable to total failure at the slightest provocation.

If you endeavour to continue in this task, backup the card after every single session, or risk losing the whole lot due to the capricious propensity of SD cards to die with no warning.

3

This can be done, although doing it successfully means tuning the OS to not constantly write to the SD card. This means moving the swap file off the sdcard and is not suitable for programs that continually update the status to disk. Having /boot on the sdcard is likely the least problematic partition.

The question is "why" do you want to do this - SD cards are small compared to hard drives, and the OS can be tuned to take very little space. Isolation of systems may be better achieved using a VM. You can run Linux off a USB hdd/ssd as well.

2
  • Are you suggesting that using a USB stick or external drive would be better? From a performance and/or risk of failure point of view.
    – point618
    Commented Dec 20, 2021 at 10:52
  • 1
    An external hdd or ssd, yes, You will most likely have similar issues on a USB pen drive to an SSD card.
    – davidgo
    Commented Dec 20, 2021 at 11:37
1

If an SD card is all you have, go for it.

Expect less than 1000 write cycles per block. That’s a couple of months with heavy use or many years with light use. Oh and most SD cards have no power loss protection during their read-copy-update cycles. So if your machine loses power at the wrong time, you’ll end up with file system corruption.

IMO the real problem besides reliability is that SD cards are incredibly slow. If you shop around, you can get an SSD for the same price per GB that’s literally 100x faster.

Not the answer you're looking for? Browse other questions tagged .