home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LINUX / HOWTO / mini / partitn.txt < prev    next >
Text File  |  1997-07-07  |  26KB  |  600 lines

  1. The Linux Partition mini-HOWTO
  2. by Kristian Koehntopp, kris@koehntopp.de
  3.  
  4. $Id: howto.txt,v 1.3 97/01/24 13:08:02 kris Exp Locker: kris $
  5.  
  6. $Log:    howto.txt,v $
  7. Revision 1.3  97/01/24  13:08:02  kris
  8. Some minor spelling corrections.
  9.  
  10. Revision 1.2  96/11/29  13:42:04  kris
  11. Revised and edited for second public release.
  12. Added:
  13. - Introduction
  14. - Introductory chapter on partitions.
  15. - Example
  16. Modified:
  17. - Turned File Systems and Fragmentation into an extra chapter.
  18.  
  19. Revision 1.1  96/11/29  10:54:06  kris
  20. Initial revision
  21.  
  22. WHAT IS THIS?
  23. =============
  24.  
  25. This is a Linux Mini-HOWTO text. A Mini-HOWTO is a small text
  26. explaining some business related to Linux installation and
  27. maintenance tutorial style. It's mini, because either the text
  28. or the topic it discusses are to small for a real HOWTO or even
  29. a book. A HOWTO is not a reference:  that's what manual pages
  30. are for.
  31.  
  32. WHAT IS IN IT? AND RELATED HOWTO DOCUMENTS
  33. ==========================================
  34.  
  35. This particular Mini-HOWTO teaches you how to plan and layout
  36. disk space for your Linux system. It talks about disk hardware,
  37. partitions, swap space sizing and positioning considerations,
  38. file systems, file system types and related topics. The intent
  39. is to teach some background knowlegde, so we are talking mainly
  40. principles and not tools in this text. 
  41.  
  42. Ideally, this document should be read before your first
  43. installation, but this is somehow difficult for most people.
  44. First timers have other problems than disk layout optimization,
  45. too. So you are probably someone who just finished a Linux
  46. installation and is now thinking about ways to optimize this
  47. installation or how to avoid some nasty miscalculations in the
  48. next one. Well, exspect some desire to tear down and rebuild
  49. your installation when you are finished with this text. :-)
  50.  
  51.  
  52. This Mini-HOWTO limits itself to planning and layouting disk
  53. space most of the time. It does not discuss the usage of fdisk,
  54. LILO, mke2fs or backup programs. There are other HOWTOs that
  55. address these problems. Please see the Linux HOWTO Index for
  56. current information on Linux HOWTOs. There are instructions for
  57. obtaining HOWTO documents in the index, too.
  58.  
  59. For instructions and considerations regarding disks with more
  60. that 1024 cylinders, see "Linux Large Disk mini-HOWTO", Andries
  61. Brouwer <aeb@cwi.nl>.
  62.  
  63. For instructions on disk spanning and striping, see "Linux
  64. Multiple Disks Layout mini-HOWTO", by Gjoen Stein
  65. <gjoen@nyx.net>.
  66.  
  67. For instructions on limiting disk space usage per user
  68. (quotas), see "Linux Quota mini-HOWTO", by Albert M.C. Tam
  69. <bertie@scn.org>.
  70.  
  71. Currently, there is no general document on disk backup, but
  72. there are several documents with pointers to specific backup
  73. solutions. See "Linux ADSM Backup mini-HOWTO", by Thomas Koenig
  74. <Thomas.Koenig@ciw.uni-karlsruhe.de> for instructions on
  75. integrating Linux into an IBM ADSM backup environment. See
  76. "Linux Backup with MSDOS mini-HOWTO", by Christopher Neufeld
  77. <neufeld@physics.utoronto.ca> for information about MS-DOS
  78. driven Linux backups.
  79.  
  80. For instructions on writing and submitting a HOWTO document, see
  81. the Linux HOWTO Index, by Greg Hankins <gregh@sunsite.unc.edu>.
  82.  
  83. Browsing through /usr/src/linux/Documentation can be very
  84. instructive, too. See ide.txt and scsi.txt for some background
  85. information on the properties of your disk drivers and have a
  86. look at the file systems/ subdirectory.
  87.  
  88.  
  89. WHAT IS A PARTITION ANYWAY?
  90. ===========================
  91.  
  92. When PC hard disks were invented people soon wanted to install
  93. multiple operating systems, even if their system had only one
  94. disk.  So a mechanism was needed to divide a single physical
  95. disk into multiple logical disks. So that's what a partition
  96. is: A contiguous section of blocks on your hard disk that is
  97. treated like a completely seperate disk by most operating
  98. systems.
  99.  
  100. It is fairly clear that partitions must not overlap: An
  101. operating system will certainly not be pleased, if another
  102. operationg system installed on the same machine were
  103. overwriting importating information because of overlapping
  104. partitions. There should be no gap between adjacent partitions,
  105. too. While this constellation is not harmful, you are wasting
  106. precious disk space by leaving space between partitions.
  107.  
  108. A disk need not be partitioned completely. You may decide to
  109. leave some space at the end of your disk that is not assigned
  110. to any of your installed operating systems, yet. Later, when it
  111. is clear which installation is used by you most of the time,
  112. you can partition this left over space and put a file system on
  113. it.
  114.  
  115.  
  116. Partitions can not be moved nor can they be resized without
  117. destroying the file system contained in it. So repartitioning
  118. usually involves backup and restore of all file systems touched
  119. during the repartitioning.  In fact it is fairly common to mess
  120. up things completely during repartitioning, so you should back
  121. up anything on any disk on that particular machine before even
  122. touching thinks like fdisk.
  123.  
  124. Well, some partitions with certain file system types on them
  125. actually CAN be split in two without losing any data (if you
  126. are lucky). For example there is a program called "fips" for
  127. splitting MS-DOS partitions into two to make room for a Linux
  128. installation without having to reinstall MS-DOS. You are still
  129. not going to touch these things without carefully backing up
  130. everything on that machine, aren't you? 
  131.  
  132. Tapes are your friend for backups. They are fast, reliable and
  133. easy to use, so you can make backups often, preferably
  134. automatically and without hassle.
  135.  
  136. Step on soapbox: And I am talking about real tapes, not that
  137. disk controller driven ftape crap. Consider buying SCSI: Linux
  138. does support SCSI natively. You don't need to load ASPI
  139. drivers, you are not losing precious HMA under Linux and once
  140. the SCSI host adapter is installed, you just attach additional
  141. disks, tapes and CD-ROMs to it. No more I/O addresses, IRQ
  142. juggling or Master/Slave and PIO-level matching. 
  143.  
  144. Plus: Proper SCSI host adapters give you high I/O performance
  145. without much CPU load. Even under heavy disk activity you will
  146. experience good response times. If you are planning to use a
  147. Linux system as a major USENET news feed or if you are about to
  148. enter the ISP business, don't even think about deploying a
  149. system without SCSI. Climb of soapbox.
  150.  
  151.  
  152. The number of partitions on an Intel based system was limited
  153. from the very beginning: The original partition table was
  154. installed as part of the boot sector and held space for only
  155. four partition entries.  These paritions are now called primary
  156. partitions. When it became clear that people needed more
  157. partitions on their systems, extended partitions were invented.
  158. The number of extended partitions is not limited: Each extended
  159. partition contains a pointer to the next extended partition,
  160. so you can have a potentially unlimited chain of partition
  161. entries.
  162.  
  163. For compatibility reasons, the space occupied by all extended
  164. partitions had to be accounted for. If you are using extended
  165. partitions, one primary partition entry is marked as "extended
  166. partition" and its starting and ending block mark the area
  167. occupied by your extended partitions. This implies that the
  168. space assigned to all extended partitions has to be contiguous.
  169.  
  170. For certain reasons having to do with device numbering, Linux
  171. cannot handle more than 4 extended partitions per drive. So in
  172. Linux you have 4 primary partitions (3 of the useable, if you
  173. are using extended partitions) and at most 4 extended
  174. partitions.
  175.  
  176. In Linux, partitions are represented by device files, /dev/hd*
  177. for IDE disks and /dev/sd* for SCSI disks. Disks are numbered
  178. a, b, c and so on, so /dev/hda is your first IDE disk and
  179. /dev/sda is your first SCSI disk. Both devices represent raw
  180. disks, starting at block one. Writing to these devices with the
  181. wrong tools will destroy the master boot loader and partition
  182. table on these disks, rendering all data on this disk unusable
  183. or making your system unbootable. Know what you are doing and,
  184. again, back up before you do it.
  185.  
  186. Primary partitions on a disk are 1, 2, 3 and 4. So /dev/hda1 is
  187. the first primary partition on the first IDE disk and so on.
  188. Extended partitions have numbers 5 and up, so /dec/sdb5 is the
  189. first extended partition on the s