Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
internet:self-hosting [2011/12/24 18:53] cyril |
internet:self-hosting [2013/09/19 16:40] (current) |
||
---|---|---|---|
Line 10: | Line 10: | ||
==== Flash cache ==== | ==== Flash cache ==== | ||
+ | === Introduction === | ||
Solutions for hybriding flash drives and hard drives have been experimented to save power on laptops, but it is quite complex in the general case and there is no final-user implementation yet, and the gains are limited on an everyday use machine. However it is a lot more efficient and simple on a server, as there are a lot less interactions with users and the panel of activities is largely reduced. Hence you only have to put on flash disk a few directories and files that the system regularly write to (the cache in RAM is enough for reading), and the disk can remain spun down for hours or days if you don't start unusual applications. | Solutions for hybriding flash drives and hard drives have been experimented to save power on laptops, but it is quite complex in the general case and there is no final-user implementation yet, and the gains are limited on an everyday use machine. However it is a lot more efficient and simple on a server, as there are a lot less interactions with users and the panel of activities is largely reduced. Hence you only have to put on flash disk a few directories and files that the system regularly write to (the cache in RAM is enough for reading), and the disk can remain spun down for hours or days if you don't start unusual applications. | ||
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|/ | 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|/ | ||
+ | |||
+ | 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't 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, | ||
+ | |||
+ | === What to cache === | ||
The main directories you need to take care of are: | The main directories you need to take care of are: | ||
- | * ''/ | + | * ''/ |
- | * ''/ | + | * ''/ |
- | * ''/ | + | * ''/ |
- | For files, create | + | If you cannot cache your whole home folder, you can cache a few files that are updated too often by putting them in a '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
* for GDM: set '' | * for GDM: set '' | ||
* for SSHD: set '' | * for SSHD: set '' | ||
* for SU: set '' | * for SU: set '' | ||
- | | + | |
+ | |||
+ | ''/ | ||
+ | * ''/ | ||
+ | |||
+ | === Configure monitors === | ||
+ | |||
+ | If you run '' | ||
+ | <code diff> | ||
+ | -DEVICESCAN | ||
+ | +# | ||
+ | +/dev/sda -d ata -n standby | ||
+ | </ | ||
+ | |||
+ | Asking the temperature | ||
+ | |||
+ | 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' | ||
+ | |||
+ | === Finding the guilty files === | ||
You can use a script similar to this one to monitor what files are being used and add them to the cache (you can then grep " | You can use a script similar to this one to monitor what files are being used and add them to the cache (you can then grep " | ||
Line 41: | Line 63: | ||
echo 0 > / | echo 0 > / | ||
</ | </ | ||
+ | You can also use '' | ||
- | Eventually if you run '' | + | === Configure |
- | < | + | |
- | -DEVICESCAN | + | Configure hdparm |
- | +# | + | < |
- | +/ | + | hdparm |
</ | </ | ||
+ | |||
+ | And for final configuration copy ''/ | ||
+ | |||
+ | You can also configure with your power manager utility if you have one. | ||
+ | |||
+ | === Optional extra configuration === | ||
You can try to tune how syslog will write to the disk to save the flash life, in ''/ | You can try to tune how syslog will write to the disk to save the flash life, in ''/ | ||
Line 57: | Line 86: | ||
}; | }; | ||
</ | </ | ||
+ | |||
+ | === 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 when you start the computer. | ||
+ | |||
+ | You can also have a look at '' | ||
+ | |||
+ | === RAM write cache === | ||
+ | |||
+ | You could also try to use the '' | ||
+ |