Because my sd card recently failed because of large number of writes to /var filesystem I would like to move it to a SAMBA/CIFS.

I tried already and the systems doesn't start at all (it is headless, so I don't know why). And when I looked at the sdcard /var I can see that RPi recreated all the directories needed and started pushing logs and other data there, instead of the /var that exists on samba.

Are there any other solutions to this? I have few files that change frequently in /var and would like to reduce the wear of sdcard.

Maybe put rootfs on CIFS? (is that possible even?)

  • 1
    Hello, and welcome to Raspberry PI SE. Beyond that, I only wanted to say two things: 1. I think Dmitry's answer is a good one, and 2. consider the possibility that the RPi may not be the right tool for the job in all cases. There are, for example, some low-cost SBCs that provide a mSATA interface which mostly avoids the issue you're having.
    – Seamus
    Commented Apr 9, 2019 at 18:23

1 Answer 1


Solution #1 would be to buy a big SD card. Decent flash memory withstands at least 300-500 cycles before it starts dying, so with a 64GB card you can write a total of 20TB to your /var. That's 50 years if you write 1GB per day.

Solution #2 would be to move /var to a RAM disk. This will reduce wear, but you're limited in the amount of data you can store in this way.

Solution #3 would be to put /var on a partition located on an external HDD.

Putting /var to a network drive is asking for trouble. Don't do it unless you enjoy to debug frequent hard-to-reproduce software crashes.

  • #1 - SD cards don't have any wear leveling, so the size of the card doesn't matter #2 - with only 1GB of RAM and a openhab taking 30% of it I can't do it #3 - why? There are network loaded rootfs since ages, I know it is not ideal, but considering that SD card performance is at most 2x that of a networked disk in my network I don't see why it would be a problem Commented Apr 9, 2019 at 11:33
  • @KrzysztofKrasoń "SD cards don't have any wear leveling" - Any decent brand does, e.g. SanDisk does it since at least 2010 on all microSD products. Commented Apr 9, 2019 at 11:39
  • @KrzysztofKrasoń Besides, have you seen this tutorial? Commented Apr 9, 2019 at 11:53
  • 1
    Oh, I wasn't aware wear leveling exists, I replaced my dead 16 GB cheap card with a smasung Evo plus 32 GB, and hope it won't die soon. As for the tutorial, yes I saw it, unfortunatelly it is only about NFS, and I have NAS with a CIFS/SMB :( Commented Apr 9, 2019 at 12:32
  • 1
    In my experience, cheap SD cards are a nightmare. I've lost valuable photos and all sorts, and I don't believe it had anything to do with wear leveling - they were just rubbish, almost certainly factory seconds. Unfortunately it's really hard to know what you are buying isn't a fake/second unless you get from a reputable seller. Amazon and eBay are full of poor quality ones, even ones that say they're not.
    – Mark Smith
    Commented Apr 9, 2019 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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