Raspberry Pi and SD card file system corruption. I have been experiencing these issues and I can’t really pinpoint the source of the trouble. I decided to take one of my Raspberry Pi’s, install Raspbian on it, and then ISPConfig, to have a test server, with a similar configuration then the server hosting this blog, –production server– as you may. — anyhow — during the installation of some packages, the file system already got corrupted — therefore this was a never finished project.
At this point, I started to suspect the specific Pi. (I have two Model B revision 1 Pi’s) But, I cannot be sure. I have run the “Overclock stability test” script on both my Pi’s, on two different SD cards. Note: I am not overclocking, but it is a stability test, that reads and writes from the SD card. Everything seemed stable. (Also when I *did* overclock a bit)
One thing to notice about this test, it performs a series of sequential reads and writes. Perhaps that’s the difference. File system corruption occurs when writing to files. Keep in mind that SD cards are actually microcontrollers, and their programming might contain some FAT specific optimisations which cause corruption when running another file system. Keeping this in mind — the random writes method I have been suggesting earlier might not trigger the error. However… I am just speculating. In the end — it could be the power supply problem some people have been suggesting.
Anyway, enough about Pi’s, now it’s time for my ODROID U3 to do something: replacing my Raspberry Pi as NFS server. The Raspberry Pi has bad performance as an NFS server anyways. Therefore, in the past, I was about to replace it with my CubieBoard. Initial tests were promising, throughput was, –as far as I can recall– double the Pi’s. I went to sleep, to discover the next day, the CubieBoard was down. I assumed it crashed for some reason, and powercycled it. It didn’t come back up. No…. since that moment, I haven’t been able to get it to do anything. No boot from NAND or µSD card, nothing on the serial interface: it’s dead.
So… now it’s about time to replace my 8530w laptop — temporary playing server — with a more permanent solution: my UDROID-U3. I am not going to discuss the entire configuration. I have discussed configuring NFS servers before. However, there are a few things I would like to discuss. I problem I have encountered before: using new nfs-utils versions with older linux kernels. The kernel for the UDROID is 22.214.171.124-3-ARCH, which is rather old.
The problem is, when starting the nfs daemon, it requests the versions on NFS to use from the kernel. Starting at nfs-utils 1.2.9, it will include 4.1 in this request. Older kernels will not recognise this and generate an error. On my Pi, I reverted to nfs-utils 1.2.8, but now, I have a more permanent solution.
[root@odroid andre]# systemctl status nfsd ● nfsd.service - NFS Server Daemon Loaded: loaded (/usr/lib/systemd/system/nfsd.service; enabled) Active: failed (Result: exit-code) since Fri 1999-12-31 18:00:31 MST; 14 years 5 months ago Docs: man:rpc.nfsd(8) Process: 294 ExecStopPost=/usr/bin/exportfs -a -u (code=exited, status=0/SUCCESS) Process: 291 ExecStop=/usr/bin/rpc.nfsd 0 (code=exited, status=0/SUCCESS) Process: 260 ExecStartPost=/usr/bin/exportfs -a (code=exited, status=1/FAILURE) Process: 233 ExecStart=/usr/bin/rpc.nfsd $NFSD_OPTS $NFSD_COUNT (code=exited, status=0/SUCCESS) Main PID: 233 (code=exited, status=0/SUCCESS) Dec 31 18:00:31 odroid rpc.nfsd: rpc.nfsd: Setting version failed: errno 22 (Invalid argument) Dec 31 18:00:31 odroid exportfs: exportfs: Failed to stat /srv/nfs4/grassroot: No such file or directory Dec 31 18:00:31 odroid systemd: nfsd.service: control process exited, code=exited status=1 Dec 31 18:00:31 odroid systemd: Failed to start NFS Server Daemon. Dec 31 18:00:31 odroid systemd: Unit nfsd.service entered failed state.
Note to audience: I have no battery connected to the RTC, so “Dec 31 18:00:31″ is a faulty date before it contacted an NTP server.
Note to self: image has an American default timezone: fix it! timedatectl set-timezone CET
The configuration file for the nfs server is /etc/conf.d/nfs-server.conf. When you open time file, you see nothing that would suggest setting a version. No, the file only specifies command line options to nfs daemon. Putting NFSD_OPTS="-V 4" does the trick. You can specify multiple versions by comma separating them, for example NFSD_OPTS="-V 2,3,4", which would enable NFS version 2, 3 and 4.