Search This Blog

Monday, April 29, 2013

Archlinux 24/7 uptime installation on a pendrive - limit flash IO (reads/writes)

Installing a box that runs 24/7 on a pendrive seems not like a best idea at first - continuous reads and writes would destroy the flash memory withing months of usage. There are some ways to minimize these, however. Two of them that come to mind at first are - let the swap file reside on a HDD instead of flash card. What about logs? - let us keep them in memory and discard when the box is being shut down.

Linux mounts partitions at boot from a file: /etc/fstab

Let /dev/sdb1 be our HDD partition and /dev/sda our flash card.
At first we need to mount HDD partition to any directory on the root of the file-system /

/dev/sdb1              /home/user/movies     ext4    defaults        0       0

Let's move the swap file to HDD instead of a flash card:

/home/user/movies/swapfile   none    swap    defaults        0       0

And create a temporary partition (discarded at shutdown) with the logs.


tmpfs   /var/log        tmpfs   defaults,noatime,mode=755       0       0


So the whole /etc/fstab file will look like this:

#
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
devpts                 /dev/pts      devpts    defaults            0      0
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0
/dev/sdb1              /home/user/movies     ext4    defaults        0       0
/home/user/movies/swapfile   none    swap    defaults        0       0
tmpfs   /var/log        tmpfs   defaults,noatime,mode=755       0       0


No comments:

Post a Comment

If you like this post, please leave a comment :)