Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
internet:self-hosting [2011/12/25 14:49]
cyril [Flash cache]
internet:self-hosting [2013/09/19 16:40] (current)
Line 15: Line 15:
 You need an USB stick or SD Card of at least 2GB (4GB is advised), and an init script to mount and fetch during early boot process, and unmount and flush during late shutdown process. For instance I wrote this one for Gentoo: [[init_fcache|/etc/init.d/fcache]] with conf [[conf_fcache|/etc/conf.d/fcache]], add it to the boot runlevel (''rc-update add fcache boot''). You need an USB stick or SD Card of at least 2GB (4GB is advised), and an init script to mount and fetch during early boot process, and unmount and flush during late shutdown process. For instance I wrote this one for Gentoo: [[init_fcache|/etc/init.d/fcache]] with conf [[conf_fcache|/etc/conf.d/fcache]], add it to the boot runlevel (''rc-update add fcache boot'').
  
-As an example, my server (a Core2 Duo laptop) consumes 12-13W (saved 1W stopping the hard drive), makes no noise at all (no fan, no hard drive), and the hard drive remains stopped for several days, as long as I don'do something unusual (I can even log in with ssh, with export display, as root, use firefox, without waking up the drive).+As an example, my server (a Core2 Duo laptop) consumes 12-13W (saved 1W stopping the hard drive), makes no noise at all (no fan, no hard drive), and the hard drive remains stopped for several days, as long as I don'interact with because it is also a multimedia server (I can even log in with ssh, with export display, as root, use firefox, without waking up the drive ; but of course listening to music stored on the hard drive, installing a program, changing some system configuration, starting an unusual program, will wake up the drive).
  
 === What to cache === === What to cache ===
  
 The main directories you need to take care of are: The main directories you need to take care of are:
-  * ''/var'' +  * ''/var'' must be cached 
-  * ''/tmp'' if not already mounted as tmpfs in ram +  * ''/tmp'' must be mounted as tmpfs in ram 
-  * ''/home'' if you have enough space+  * ''/home'' can be cached if you have enough space on the flash disk
  
 If you cannot cache your whole home folder, you can cache a few files that are updated too often by putting them in a ''~/.fcache'' directory that you will cache. Then either create a symbolic link (if it works, meaning that the file is not deleted and recreated each time) or configure the program to use this new location: If you cannot cache your whole home folder, you can cache a few files that are updated too often by putting them in a ''~/.fcache'' directory that you will cache. Then either create a symbolic link (if it works, meaning that the file is not deleted and recreated each time) or configure the program to use this new location:
Line 32: Line 32:
     * for SSHD: set ''XAUTHORITY=/home/cyril/.fcache/.Xauthority'' in ''~/.ssh/environment'', and ''PermitUserEnvironment yes'' in ''/etc/ssh/sshd_config''      * for SSHD: set ''XAUTHORITY=/home/cyril/.fcache/.Xauthority'' in ''~/.ssh/environment'', and ''PermitUserEnvironment yes'' in ''/etc/ssh/sshd_config'' 
     * for SU: set ''cyril'' (your username) in ''/root/.xauth/import'', to avoid creation of ''/root/.xauthXXXXX'' files     * for SU: set ''cyril'' (your username) in ''/root/.xauth/import'', to avoid creation of ''/root/.xauthXXXXX'' files
 +  * application data folder of programs you commonly use (firefox, music player, ...)
  
-''/etc'' cannot be cached entirely, because it contains the init scripts that are used to setup fcache (''/etc/init.d''), but there are some files that would be interesting to cache (WIP)+''/etc'' cannot be cached entirely, because it contains the init scripts that are used to setup fcache (''/etc/init.d''), but there are some files that are necessary to cache: 
-  * ''/etc/resolv.conf''+  * ''/etc/resolv.conf'': symlink ok.
  
-=== Configure smartd ===+=== Configure monitors ===
  
 If you run ''smartd'' daemon, it will wakes up the drive every 30min by default to perform some checks (or with the interval specified by the ''-i'' option of ''smartd''). You have to tell it to not do tests if the drive is in standby powermode. Edit ''/etc/smartd.conf'': If you run ''smartd'' daemon, it will wakes up the drive every 30min by default to perform some checks (or with the interval specified by the ''-i'' option of ''smartd''). You have to tell it to not do tests if the drive is in standby powermode. Edit ''/etc/smartd.conf'':
Line 44: Line 45:
 +/dev/sda -d ata -n standby +/dev/sda -d ata -n standby
 </code> </code>
 +
 +Asking the temperature to the ''hddtemp'' daemon will also wake up the drive, so you should not use it.
 +
 +Also be careful to conflicts between manual configuration and different power manager utilities (like pm-utils, your desktop environment...). You may have to disable some of them if it doesn't work.
  
 === Finding the guilty files === === Finding the guilty files ===
Line 68: Line 73:
  
 And for final configuration copy ''/usr/lib/pm-utils/power.d/harddrive'' file to ''/etc/pm/power.d/'' and set variable ''DRIVE_SPINDOWN_VALUE_BAT'' to 241 for instance for 30 minutes (check option -S in hdparm's man page). And for final configuration copy ''/usr/lib/pm-utils/power.d/harddrive'' file to ''/etc/pm/power.d/'' and set variable ''DRIVE_SPINDOWN_VALUE_BAT'' to 241 for instance for 30 minutes (check option -S in hdparm's man page).
 +
 +You can also configure with your power manager utility if you have one.
  
 === Optional extra configuration === === Optional extra configuration ===
Line 82: Line 89:
 === Read cache === === Read cache ===
  
-You can try to prefetch in the Linux RAM read cache all the programs and files you often read, with a script that executes programs and grep inside files.+You can try to prefetch in the Linux RAM read cache all the programs and files you often read, with a script that executes programs and grep inside files when you start the computer.
  
-You can also have a look at ''e4rat'' that optimizes the boot process but also prefetches files used at boot.+You can also have a look at ''e4rat'' that optimizes the boot process but also prefetches files used at boot, and ''preload'' that adaptatively preloads the programs you usually use.
  
 === RAM write cache === === RAM write cache ===
internet/self-hosting.1324824546.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0