so i just built a new file server. i’m trying to keep it as low power as possible. it’s quite minimal, with an atom processor, a mini itx intel motherboard and a wd “green” hard drive. that’s pretty much it. it should be drawing less than 30W and probably closer to 20W. i need to measure it. anyways, i want to keep the hard drive strictly for data, thus keeping the os separate. so i decided to install ubuntu server on a flash drive. pretty straightforward and easy. however, i got concerned about how long this flash drive would last if you run an os off of it. they only have a finite number of write cycles before being unusable.
usually this number is 10,000 to 100,000 writes per memory block (lets call them cells). luckily, many flash drives these days have built in controllers to implement “wear leveling”. this spreads its writes evenly over the memory cells so you’re not writing a single cell over and over again. it will write a different one, then another different one, and so on. knowing this, lets try to make a rough estimate of how long my 4GB flash drive will last.
first i set up my / mount with the noatime option to minimizes the kjournald writes since i’m using ext3. everything else is pretty much default. logging is still on and no redirect writes. my server is still a basic setup. just hosting a couple of sites and my file shares. given this, i used iostat to view how many writes were occurring during normal operation. from an initial boot (a lot of writes) to 24 hours of operation, it showed that there were 1.89 Blk_wrtn/s. 1.89 “blocks” written per second over 24 hours. these blocks are 512 bytes, or 512 memory cells. now ideally i would run this for a while to get a more accurate number, but i’m too lazy and i just want a ballpark number (within a magnitude). and 1.89 seems little to me (my data drive shows 78.07 blocks written/s right now). so to be a little more conservative, lets say my server eventually gets busier and writes 8 blocks per second. more than four times what its doing right now. right now my 4 GB flash drive has about 2 GB free. since my flash drive uses dynamic wear leveling, it only distributes writes over free space. so we have 2 GB to work with.
time for math. 60*60*24*365.25=31557600 seconds in a year. at the rate of 8 blocks per second, that’s 31557600*8=252460800 blocks per year or 129259929600 bytes per year (512 bytes per block). thats 129260 MB or 129 GB. with 2 GB to wear level over, that’s about 65 writes per memory cell over a year. that’s it! if they guarantee 10,000 writes per cell, then it would take about 153 years to reach that number. for 100,000 writes/cell, 1538 years! if i want to make sure my flash drive lasts 15 years, i can afford 80 blocks written per second. perhaps i shouldn’t be so worried about destroying my flash drive.
am i doing this math right? am i missing anything?
this post is so hot. seriously. because i love it when you speak nerdy.