mikey32094
Posts: 38
Joined: Sat Jul 25, 2015 10:07 am

Trying to avoid OS corruption with custom partitioning

Tue Nov 15, 2016 11:16 pm

Hello all,

I'm trying to bulletproof my install from SD card corruption due to frequent logfile writing. I'd like not to mount /var/log to a temporary file system because I'd like to be able to read them after a reboot.

I was thinking about trying a custom partition layout. Say, two extra partitions - one for linux-swap, and another to be used/mounted exclusively for logs and other frequently written files. My reasoning is: If I get corruption due to a hard reset, I'll only lose the logfile/swap data, and not my entire OS.

I was unable to get gparted to resize/shrink the main partition, either directly on the SD card, or by a dd copies img file. I'm guessing this is because raspbian is just 1 partition with no partition table??

What about if I made my own partition table, then dd copied the raspbian image onto one of my new partitions ... then went through the pain of chroot'ing grub to try and get the boot record fixed.

Has anybody tried anything like this?

ejolson
Posts: 4506
Joined: Tue Mar 18, 2014 11:47 am

Re: Trying to avoid OS corruption with custom partitioning

Wed Nov 16, 2016 1:48 am

mikey32094 wrote:Hello all,

I'm trying to bulletproof my install from SD card corruption due to frequent logfile writing. I'd like not to mount /var/log to a temporary file system because I'd like to be able to read them after a reboot.

I was thinking about trying a custom partition layout. Say, two extra partitions - one for linux-swap, and another to be used/mounted exclusively for logs and other frequently written files. My reasoning is: If I get corruption due to a hard reset, I'll only lose the logfile/swap data, and not my entire OS.

I was unable to get gparted to resize/shrink the main partition, either directly on the SD card, or by a dd copies img file. I'm guessing this is because raspbian is just 1 partition with no partition table??

What about if I made my own partition table, then dd copied the raspbian image onto one of my new partitions ... then went through the pain of chroot'ing grub to try and get the boot record fixed.

Has anybody tried anything like this?
Multiple partitions do not help because the problems arise at the sdcard firmware level when the microcontroller on the card swaps sectors around for wear leveling. Store the log files on a separate thumb drive or remotely.

mikey32094
Posts: 38
Joined: Sat Jul 25, 2015 10:07 am

Re: Trying to avoid OS corruption with custom partitioning

Wed Nov 16, 2016 10:11 pm

Ah. Thanks for the tip. I guess a thumb drive it is!

Return to “Advanced users”