Page 1 of 1

Trying to avoid OS corruption with custom partitioning

Posted: Tue Nov 15, 2016 11:16 pm
by mikey32094
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?

Re: Trying to avoid OS corruption with custom partitioning

Posted: Wed Nov 16, 2016 1:48 am
by ejolson
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.

Re: Trying to avoid OS corruption with custom partitioning

Posted: Wed Nov 16, 2016 10:11 pm
by mikey32094
Ah. Thanks for the tip. I guess a thumb drive it is!