home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / MULTIPL0 < prev    next >
Encoding:
Text File  |  1996-08-18  |  21.4 KB  |  496 lines

  1.  
  2.     Mini_HOWTO: Multi Disk System Tuning
  3.  
  4.     Version 0.6
  5.     Date 960806
  6.     By Stein Gjoen <sgjoen@nyx.net>
  7.  
  8. This document was written for two reasons, mainly because I got hold
  9. of 3 old SCSI disks to set up my Linux system on and I was pondering
  10. how best to utilise the inherent possibilities of parallelizing in a
  11. SCSI system. Secondly I hear there is a prize for people who write
  12. docs...
  13.  
  14. This is intended to be read in conjunction with the Linux File System
  15. Standard (FSSTD). It does not in any way replace it but tries to
  16. suggest where physically to place directories detailed in the FSSTD,
  17. in terms of drives, partitions, types, RAID, file system (fs),
  18. physical sizes and other parameters that should be considered and
  19. tuned in a Linux system, ranging from single home systems to large
  20. servers on the Internet.
  21.  
  22. This is also a learning experience for myself and I hope I can start
  23. the ball rolling with this Mini-HOWTO and that it perhaps can evolve
  24. into a larger more detailed and hopefully even more correct HOWTO.
  25. Notes in square brackets indicate where I need more information.
  26.  
  27. Note that this is a guide on how to design and map logical partitions
  28. onto multiple disks and tune for performance and reliability, NOT how
  29. to actually partition the disks or format them - yet.
  30.  
  31. This is the third update, still without much in the way of inputs...
  32. Nevertheless this mini-HOWTO seems to be growing regardless and I
  33. expect I will have to turn this into a fully fledged HOWTO one of
  34. these days, I just need to learn the format.
  35.  
  36. Hot news: I have been asked to add information on physical storage
  37. media as well as partitioning and make it all into a full sized
  38. HOWTO. this will take a bit of time to complete which means that
  39. other than bug fixes to this mini-HOWTO it will not be updated much
  40. until the new HOWTO is ready. In the meantime I will of course still
  41. be interested in feedback.
  42.  
  43. More news: there has been a fair bit of interest in new kinds of
  44. file systems in the comp.os.linux newsgroups, in particular
  45. logging, journaling and inherited file systems. Watch out for
  46. updates.
  47.  
  48. The latest version number of this document can be gleaned from my
  49. plan entry if you do "finger sgjoen@nox.nyx.net"
  50.  
  51.  
  52. In this version I have the pleasure of acknowledging even more people
  53. who have contributed in one way or another:
  54.  
  55.    ronnej@ucs.orst.edu
  56.    cm@kukuruz.ping.at
  57.    armbru@pond.sub.org
  58.    nakano@apm.seikei.ac.jp  (who is also doing the Japanese translation)
  59.    R.P.Blake@open.ac.uk
  60.    neuffer@goofy.zdv.Uni-Mainz.de
  61.    sjmudd@phoenix.ea4els.ampr.org
  62.  
  63. Not many still, so please read through this document, make a contribution
  64. and join the elite. If I have forgotten anyone, please let me know.
  65.  
  66. So let's cut to the chase where swap and /tmp are racing along hard
  67. drive...
  68.  
  69. ---------------------------------------------------------------
  70.  
  71. 1. Considerations
  72.  
  73. The starting point in this will be to consider where you are and what
  74. you want to do. The typical home system starts out with existing
  75. hardware and the newly converted Linux user will want to get the most
  76. out of existing hardware. Someone setting up a new system for a
  77. specific purpose (such as an Internet provider) will instead have to
  78. consider what the goal is and buy accordingly. Being ambitious I will
  79. try to cover the entire range.
  80.  
  81. Various purposes will also have different requirements regarding file
  82. system placement on the drives, a large multiuser machine would
  83. probably be best off with the /home directory on a separate disk, just
  84. to give an example.
  85.  
  86. In general, for performance it is advantageous to split most things
  87. over as many disks as possible but there is a limited number of
  88. devices that can live on a SCSI bus and cost is naturally also a
  89. factor. Equally important, file system maintenance becomes more
  90. complicated as the number of partitions and physical drives increases.
  91.  
  92.  
  93. 1.1 File system features
  94.  
  95. The various parts of FSSTD have different requirements regarding
  96. speed, reliability and size, for instance losing root is a pain but
  97. can easily be recovered. Losing /var/spool/mail is a rather different
  98. issue. Here is a quick summary of some essential parts and their
  99. properties and requirements. [This REALLY need some beefing up]:
  100.  
  101. 1.1.1 Swap
  102.  
  103. Speed:         Maximum! Though if you rely too much on swap you
  104. should consider buying some more RAM.
  105.  
  106. Size:        Similar as for RAM. Quick and dirty algorithm:
  107. just as for tea: 16M for the machine and 2M for each user. Smallest
  108. kernel run in 1M but is tight, use 4M for general work and light
  109. applications, 8M for X11 or GCC or 16M to be comfortable. [The
  110. author is known to brew a rather powerful cuppa tea...]
  111.  
  112. Some suggest that swapspace should be 1-2 times the size of the
  113. RAM, pointing out that the locality of the programs determines how
  114. effective your added swapspace is. Note that using the same
  115. algorithm as for 4BSD is slightly incorrect as Linux does not
  116. allocate space for pages in core [More on this is coming soon].
  117.  
  118. Reliability:    Medium. When it fails you know it pretty quickly and
  119. failure will cost you some lost work. You save often, don't you?
  120.  
  121. Note 1:        Linux offers the possibility of interleaved swapping
  122. across multiple devices, a feature that can gain you much. Check out
  123. the "man 8 swapon" for more details. However, software raiding across
  124. multiple devices adds more overheads than you gain.
  125.  
  126. Note 2:        Some people use a RAM disk for swapping or some other
  127. filesystems. However, unless you have some very unusual requirements
  128. or setups you are unlikely to gain much from this as this cuts into
  129. the memory available for caching and buffering.
  130.  
  131. 1.1.2 /tmp and /var/tmp
  132.  
  133. Speed:        Very high. On a separate disk/partition this will
  134. reduce fragmentation generally, though ext2fs handles fragmentation
  135. rather well.
  136.  
  137. Size:        Hard to tell, small systems are easy to run with just
  138. a few MB but these are notorious hiding places for stashing files
  139. away from prying eyes and quota enforcements and can grow without
  140. control on larger machines. Suggested: small machine: 8M, large
  141. machines up to 500M (The machine used by the author at work has 1100
  142. users and a 300M /tmp directory).
  143.  
  144. Reliability:    Low. Often programs will warn or fail gracefully when
  145. these areas fail or are filled up. Random file errors will of course
  146. be more serious, no matter what file area this is.
  147.  
  148.  (* That was 50 lines, I am home and dry! *)
  149.  
  150. 1.1.3 Spool areas (/var/spool/news, /var/spool/mail)
  151.  
  152. Speed:        High, especially on large news servers. News transfer
  153. and expiring are disk intensive and will benefit from fast drives. 
  154. Print spools: low. Consider RAID0 for news.
  155.  
  156. Size:        For news/mail servers: whatever you can afford. For
  157. single user systems a few MB will be sufficient if you read
  158. continuously.  Joining a list server and taking a holiday is on the
  159. other hand it is not a good idea.  (Again the machine I use at work
  160. has 100M reserved for the entire /var/spool)
  161.  
  162. Reliability:    Mail: very high, news: medium, print spool: low. If
  163. your mail is very important (isn't it always?) consider RAID for
  164. reliability. [Is mail spool failure frequent? I have never experienced
  165. it but there are people catering to this market of reliability...]
  166.  
  167. Note:        Some of the news documentation suggests putting all
  168. the .overview files on a drive separate from the news files, check out
  169. all news FAQs for more information.
  170.  
  171. 1.1.4 Home directories (/home)
  172.  
  173. Speed:        Medium. Although many programs use /tmp for temporary
  174. storage, other such as some newsreaders frequently update files in the
  175. home directory which can be noticeable on large multiuser systems. For
  176. small systems this is not a critical issue.
  177.  
  178. Size:        Tricky! On some systems people pay for storage so this
  179. is usually then a question of finance. Large systems such as nyx.net
  180. (which is a free Internet service with mail, news and WWW services)
  181. run successfully with a suggested limit of 100K per user and 300K as
  182. max. If however you are writing books or are doing design work the
  183. requirements balloon quickly.
  184.  
  185. Reliability:    Variable. Losing /home on a single user machine is
  186. annoying but when 2000 users call you to tell you their home
  187. directories are gone it is more than just annoying. For some their
  188. livelihood relies on what is here. You do regular backups of course?
  189.  
  190. Note:        You might consider RAID for either speed or
  191. reliability. If you want extremely high speed and reliability you
  192. might be looking at other OSes and platforms anyway. (Fault tolerance
  193. etc.)
  194.  
  195. 1.1.5 Main binaries ( /usr/bin and /usr/local/bin)
  196.  
  197. Speed:        Low. Often data is bigger than the programs which are
  198. demand loaded anyway so this is not speed critical. Witness the
  199. successes of live file systems on CD ROM.
  200.  
  201. Size:        The sky is the limit but 200M should give you most of
  202. what you want for a comprehensive system. (The machine I use, including
  203. the libraries, uses about 800M)
  204.  
  205. Reliability:    Low. This is usually mounted under root where all
  206. the essentials are collected. Nevertheless losing all the binaries is
  207. a pain...
  208.  
  209. 1.1.6 Libraries ( /usr/lib and /usr/local/lib)
  210.  
  211. Speed:        Medium. These are large chunks of data loaded often,
  212. ranging from object files to fonts, all susceptible to bloating. Often
  213. these are also loaded in their entirety and speed is of some use here.
  214.  
  215. Size:        Variable. This is for instance where word processors
  216. store their immense font files. The few that have given me feedback on
  217. this report about 70M in their various lib directories. The following
  218. ones are some of the largest diskhogs: GCC, Emacs, TeX/LaTeX, X11 and
  219. perl.
  220.  
  221. Reliability:    Low. See point 1.1.5
  222.  
  223. 1.1.7 Root
  224.  
  225. Speed:        Quite low: only the bare minimum is here, much of
  226. which is only run at startup time.
  227.  
  228. Size:        Relatively small. However it is a good idea to keep
  229. some essential rescue files and utilities on the root partition and
  230. some keep several kernel versions. Feedback suggests about 20M would
  231. be sufficient.
  232.  
  233.  
  234. Reliability: High. A failure here will possible cause a bit of grief
  235. and can take a little time rescuing your boot partition. Naturally
  236. you do have a rescue disk?
  237.  
  238.  
  239. 1.2 Explanation of terms
  240.  
  241. Naturally the faster the better but often the happy installer of Linux
  242. has several disks of varying speed and reliability so even though this
  243. document describes performance as 'fast' and 'slow' it is just a rough
  244. guide since no finer granularity is feasible. Even so there are a few
  245. details that should be kept in mind:
  246.  
  247. 1.2.1 Speed
  248.  
  249. This is really a rather woolly mix of several terms: CPU load,
  250. transfer setup overhead, disk seek time and transfer rate. It is in
  251. the very nature of tuning that there is no fixed optimum, and in most
  252. cases price is the dictating factor. CPU load is only significant for
  253. IDE systems where the CPU does the transfer itself [more details
  254. needed here !!] but is generally low for SCSI, see SCSI documentation
  255. for actual numbers. Disk seek time is also small, usually in the
  256. millisecond range. This however is not a problem if you use command
  257. queueing on SCSI where you then overlap commands keeping the bus busy
  258. all the time. News spools are a special case consisting of a huge
  259. number of normally small files so in this case seek time can become
  260. more significant.
  261.  
  262. 1.2.2 Reliability
  263.  
  264. Naturally none wants low reliability disks but one might be better off
  265. regarding old disks as unreliable. Also for RAID purposes (See the
  266. relevant docs) it is suggested to use a mixed set of disks so that
  267. simultaneous disk crashes becomes less likely.
  268.  
  269.  
  270. 1.3 Technologies
  271.  
  272. In order to decide how to get the most of your devices you need to
  273. know what technologies are available and their implications. As always
  274. there can be some tradeoffs with respect to speed, reliability, power,
  275. flexibility, ease of use and complexity.
  276.  
  277. 1.3.1 RAID
  278.  
  279. This is a method of increasing reliability, speed or both by using multiple
  280. disks in parallel thereby decreasing access time and increasing transfer
  281. speed. A checksum or mirroring system can be used to increase reliability.
  282. Large servers can take advantage of such a setup but it might be overkill
  283. for a single user system unless you already have a large number of disks
  284. available. See other docs and FAQs for more information.
  285.  
  286. For Linux one can set up a RAID system using either software (the md module
  287. in the kernel) or hardware, using a Linux compatible controller. Check the
  288. documentation for what controllers can be used. A hardware solution is
  289. usually faster, and perhaps also safer, but comes at a significant cost.
  290.  
  291. 1.3.2 AFS, Veritas and Other Volume Management Systems
  292.  
  293. Although multiple partitions and disks have the advantage of making for more
  294. space and higher speed and reliability there is a significant snag: if for
  295. instance the /tmp partition is full you are in trouble even if the news spool
  296. is empty, it is not easy to retransfer quotas across disks. Volume management
  297. is a system that does just this and AFS and Veritas are two of the best known
  298. examples. Some also offer other file systems like log file systems and others
  299. optimised for reliability or speed. Note that Veritas is not available (yet)
  300. for Linux and it is not certain they can sell kernel modules without providing
  301. source for their proprietary code, this is just mentioned for information on
  302. what is out there. Still, you can check their web page http://www.veritas.com
  303. to see how such systems function.
  304.  
  305. Derek Atkins, of MIT, ported AFS to Linux and has also set up a mailing list
  306. for this: linux-afs@mit.edu which is open to the public, requests to join
  307. the list goes to linux-afs-request@mit.edu and finally bug reports should
  308. go to linux-afs-bugs@mit.edu. Important: as AFS uses encryption it is
  309. restricted software and cannot easily be exported from the US. AFS is now
  310. sold by Transarc and they have set up a www site. The directory structure
  311. there has been reorganized recently so I cannot give a more accurate URL
  312. than just http://www.transarc.com which lands you in the root of the web
  313. site. There you can also find much general information as well as a FAQ.
  314.  
  315. 1.3.3 Linux md Kernel Patch
  316.  
  317. There is however one kernel project that attempts to do some of this, md,
  318. which has been part of the kernel distributions since 1.3.69. Currently
  319. providing spanning and RAID it is still in early development and people are
  320. reporting varying degrees of success as well as total wipe out. Use with
  321. caution.
  322.  
  323. 1.3.4 General File System Consideration
  324.  
  325. In the Linux world ext2fs is well established as a general purpose system.
  326. Still for some purposes others can be a better choice. News spools lend
  327. themselves to a log file based system whereas high reliability data might
  328. need other formats. This is a hotly debated topic and there are currently
  329. few choices available but work is underway. Log file systems also have the
  330. advantage of very fast file checking. Mailservers in the 100G class can
  331. suffer file checks taking several days before becoming operational after
  332. rebooting.
  333.  
  334.  
  335. [I believe someone from Yggdrasil mentioned a log file based
  336. system once, details? And AFS is available to Linux I think, sources
  337. anyone?]
  338.  
  339.  
  340. There is room for access control lists (ACL) and other unimplemented
  341. features in the existing ext2fs, stay tuned for future updates. There has
  342. been some talk about adding on the fly compression too.
  343.  
  344. 1.3.5 Compression
  345.  
  346. Disk versus file compression is a hotly debated topic especially regarding
  347. the added danger of file corruption. Nevertheless there are several options
  348. available for the adventurous administrators. These take on many forms,
  349. from kernel modules and patches to extra libraries but note that most
  350. suffer various forms of limitations such as being read-only. As development
  351. takes place at neckbreaking speed the specs have undoubtedly changed by the
  352. time you read this. As always: check the latest updates yourself. Here only
  353. a few references are given.
  354.  
  355.  - DouBle features file compression with some limitations.
  356.  - Zlibc adds transparent on-the-fly decompression of files as they load.
  357.  - there are many modules available for reading compressed files or
  358. partitions that are native to various other operating systems though
  359. currently most of these are read-only.
  360.  
  361. Also there is the user file system that allows ftp based file system and
  362. some compression (arcfs) plus fast prototyping and many other features.
  363.  
  364. Recent kernels feature the loop or loopback device which can be used to put
  365. a complete file system within a file. There are some possibilities for
  366. using this for making new filesystems with compression, tarring etc.
  367.  
  368. Note that this device is unrelated to the network loopback device.
  369.  
  370. 1.3.5 Physical Sector Positioning
  371.  
  372. Some seek time reduction can be achieved by positioning frequently
  373. accessed sectors in the middle so that the average seek distance and
  374. therefore the seek time is short. This can be done either by using
  375. fdisk or cfdisk to make a partition on the middle sectors or by first
  376. making a file (using dd) equal to half the size of the entire disk
  377. before creating the files that are frequently accessed, after which
  378. the dummy file can be deleted. Both cases assume starting from an
  379. empty disk.
  380.  
  381. This little trick can be used both on ordinary drives as well as RAID
  382. systems. In the latter case the calculation for centering the sectors
  383. will be different, if possible. Consult the latest RAID manual.
  384.  
  385.  
  386. 2 Disk Layout
  387.  
  388. With all this in mind we are now ready to embark on the layout [and no
  389. doubt controversy]. I have based this on my own method developed when I
  390. got hold of 3 old SCSI disks and boggled over the possibilities.
  391.  
  392. 2.1 Selection
  393.  
  394. Determine your needs and set up a list of all the parts of the file system
  395. you want to be on separate partitions and sort them in descending order of
  396. speed requirement and how much space you want to give each partition.
  397.  
  398. If you plan to RAID make a note of the disks you want to use and what
  399. partitions you want to RAID. Remember various RAID solutions offers
  400. different speeds and degrees of reliability.
  401.  
  402. (Just to make it simple I'll assume we have a set of identical SCSI disks
  403. and no RAID)
  404.  
  405. 2.2 Mapping
  406.  
  407. Then we want to place the partitions onto physical disks. The point of the
  408. following algorithm is to maximise parallelizing and bus capacity. In this
  409. example the drives are A, B and C and the partitions are 987654321 where 9
  410. is the partition with the highest speed requirement. Starting at one drive
  411. we 'meander' the partition line over and over the drives in this way:
  412.  
  413.     A : 9 4 3
  414.     B : 8 5 2
  415.     C : 7 6 1
  416.  
  417. This makes the 'sum of speed requirements' the most equal across each
  418. drive.
  419.  
  420. 2.3 Optimizing
  421.  
  422. After this there are usually a few partitions that have to be 'shuffled' over
  423. the drives either to make them fit or if there are special considerations
  424. regarding speed, reliability, special file systems etc. Nevertheless this
  425. gives [what this author believes is] a good starting point for the complete
  426. setup of the drives and the partitions. In the end it is actual use that will
  427. determine the real needs after we have made so many assumptions. After
  428. commencing operations one should assume a time comes when a repartitioning
  429. will be beneficial.
  430.  
  431. 2.4 Pitfalls
  432.  
  433. The dangers of splitting up everything into separate partitions are
  434. briefly mentioned in the section about volume management. Still, several
  435. people have asked me to emphasize this point more strongly: when one
  436. partition fills up it cannot grow any further, no matter if there is
  437. plenty of space in other partitions.
  438.  
  439. In particular look out for explosive growth in the news spool
  440. (/var/spool/news). For multi user machines with quotas keep
  441. an eye on /tmp and /var/tmp as some people try to hide their
  442. files there, just look out for filenames ending in gif or jpeg...
  443.  
  444. In fact, for single physical drives this scheme offers very little gains
  445. at all, other than making file growth monitoring easier (using 'df') and
  446. there is no scope for parallel disk access. A freely available volume
  447. management system would solve this but this is still some time in the
  448. future.
  449.  
  450. Partitions and disks are easily monitored using 'df' and should be done
  451. frequently, perhaps using a cron job or some other general system
  452. management tool. [Is any such tool currently available?]
  453.  
  454.  
  455. 3 Further Information
  456.  
  457. There is wealth of information one should go through when setting up a
  458. major system, for instance for a news or general Internet service provider. 
  459. The FAQs in the following groups are useful:
  460.  
  461.     News groups:
  462. comp.arch.storage, comp.sys.ibm.pc.hardware.storage, alt.filesystems.afs,
  463. comp.periphs.scsi ...
  464.     Mailing lists:
  465. raid, scsi ...
  466.  
  467. Many mailing lists are at vger.rutgers.edu but this is notoriously
  468. overloaded, try to find a mirror. There are some lists mirrored at
  469. http://www.redhat.com [more references please!].
  470. Remember you can also use the web search engines and that some, like
  471. altavista, also can search usenet news.
  472.  
  473. [much more info needed here]
  474.  
  475. 4 Concluding Remarks
  476.  
  477. Disk tuning and partition decisions are difficult to make, and there are no
  478. hard rules here. Nevertheless it is a good idea to work more on this as the
  479. payoffs can be considerable. Maximizing usage on one drive only while the
  480. others are idle is unlikely to be optimal, watch the drive light, they are
  481. not there just for decoration. For a properly set up system the lights should
  482. look like Christmas in a disco. Linux offers software RAID but also support
  483. for some hardware base SCSI RAID controllers. Check what is available. As
  484. your system and experiences evolve you are likely to repartition and you
  485. might look on this document again. Additions are always welcome.
  486.  
  487. Currently the only supported hardware SCSI RAID controllers are the
  488. SmartCache [I/III/IV] and SmartRAID [I/III/IV] controller families
  489. from DTP. These controllers are supported by the EATA/DMA driver in
  490. the standard kernel. This company also has an informative web page
  491. at http://www.dpt.com which also describes various general aspects
  492. of RAID and SCSI in addition to the product related information.
  493. [Please let me know if there are other hardware RAID controllers
  494. available for linux.]
  495.  
  496.