/[gentoo]/xml/htdocs/doc/en/lvm2.xml
Gentoo

Diff of /xml/htdocs/doc/en/lvm2.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.26 Revision 1.27
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/lvm2.xml,v 1.26 2011/06/16 21:35:48 nightmorph Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/lvm2.xml,v 1.27 2011/12/26 15:22:40 swift Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide> 5<guide>
6<title>Gentoo LVM2 installation</title> 6<title>Gentoo LVM2 installation</title>
7 7
22 22
23<!-- The content of this document is licensed under the CC-BY-SA license --> 23<!-- The content of this document is licensed under the CC-BY-SA license -->
24<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 24<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
25<license/> 25<license/>
26 26
27<version>3</version> 27<version>4</version>
28<date>2011-06-16</date> 28<date>2011-12-26</date>
29 29
30<chapter> 30<chapter>
31<title>Introduction</title> 31<title>Introduction</title>
32<section> 32<section>
33<body> 33<body>
34 34
35<p> 35<p>
36This guide is based on an example with two IDE hard disks. It means that you 36This guide is based on an example with two SATA hard disks. It means that you
37will more than likely need to change the drive, partition names and partition 37will more than likely need to change the drive, partition names and partition
38sizes to match your own setup and needs. 38sizes to match your own setup and needs.
39</p> 39</p>
40 40
41<warn> 41<warn>
81<section> 81<section>
82<title>Partitions</title> 82<title>Partitions</title>
83<body> 83<body>
84 84
85<p> 85<p>
86Our example system has two IDE hard disks and will be partitioned as follows: 86Our example system has two SATA hard disks and will be partitioned as follows:
87</p> 87</p>
88 88
89<ul> 89<ul>
90 <li>/dev/hda1 -- /boot</li> 90 <li>/dev/sda1 -- /boot</li>
91 <li>/dev/hda2 -- (swap)</li> 91 <li>/dev/sda2 -- (swap)</li>
92 <li>/dev/hda3 -- /</li> 92 <li>/dev/sda3 -- /</li>
93 <li>/dev/hda4 -- Will be used by LVM2</li> 93 <li>/dev/sda4 -- Will be used by LVM2</li>
94 <li>/dev/hdb1 -- Will be used by LVM2</li> 94 <li>/dev/sdb1 -- Will be used by LVM2</li>
95</ul> 95</ul>
96 96
97<impo> 97<impo>
98Pay attention to the partition names as it is easy to confuse the a's and b's, 98Pay attention to the partition names as it is easy to confuse the a's and b's,
99and the partition numbers. One false move could wipe out the wrong partition. 99and the partition numbers. One false move could wipe out the wrong partition.
123mentioned above as an example. It is only <e>an example</e>, adapt it to your 123mentioned above as an example. It is only <e>an example</e>, adapt it to your
124own needs. 124own needs.
125</p> 125</p>
126 126
127<p> 127<p>
128Create a small physical <path>/boot</path> partition (hda1). In this example, 128Create a small physical <path>/boot</path> partition (sda1). In this example,
129<path>/boot</path> will be not managed by LVM2. This partition will contain 129<path>/boot</path> will be not managed by LVM2. This partition will contain
130your bootloader and your kernel(s). A 64MB partition should be well enough for 130your bootloader and your kernel(s). A 64MB partition should be well enough for
131quite a few kernel generations. 131quite a few kernel generations.
132</p> 132</p>
133 133
134<p> 134<p>
135Create a swap partition (hda2). 135Create a swap partition (sda2).
136</p>
137
138<p> 136</p>
137
138<p>
139Create a / (root) partition (hda3). If you are interested in trying to put your 139Create a / (root) partition (sda3). If you are interested in trying to put your
140root partition under LVM management (which we do not recommend), see the 140root partition under LVM management (which we do not recommend), see the
141resources section at the end of this guide for a link to a mini-howto on how to 141resources section at the end of this guide for a link to a mini-howto on how to
142do this. The size of the root partition need not be large if you will keep 142do this. The size of the root partition need not be large if you will keep
143<path>/opt /usr /home /var</path> and <path>/tmp</path> in an LVM2 Volume Group 143<path>/opt /usr /home /var</path> and <path>/tmp</path> in an LVM2 Volume Group
144(vg). In this case, 1GB should be sufficient. 144(vg). In this case, 1GB should be sufficient.
168until you know you need it. As an example, one contributor had split his 168until you know you need it. As an example, one contributor had split his
169160&nbsp;Gb hard disk into 8 partitions of 20&nbsp;Gb each. 169160&nbsp;Gb hard disk into 8 partitions of 20&nbsp;Gb each.
170</note> 170</note>
171 171
172<p> 172<p>
173Create the filesystems on <path>/dev/hda1</path> and <path>/dev/hda3</path>, 173Create the filesystems on <path>/dev/sda1</path> and <path>/dev/sda3</path>,
174and create and activate the swap on <path>/dev/hda2</path> as described in the 174and create and activate the swap on <path>/dev/sda2</path> as described in the
175handbook. 175handbook.
176</p> 176</p>
177 177
178<p> 178<p>
179Start the lvm service. 179Start the lvm service.
195<p> 195<p>
196Before scanning and activating LVM, you might want to edit 196Before scanning and activating LVM, you might want to edit
197<path>/etc/lvm/lvm.conf</path> to exclude some devices. By default, LVM2 will 197<path>/etc/lvm/lvm.conf</path> to exclude some devices. By default, LVM2 will
198scan all devices, even your CDROM which can generate error messages. In the 198scan all devices, even your CDROM which can generate error messages. In the
199following example, the line that allows scanning of all devices is replaced by 199following example, the line that allows scanning of all devices is replaced by
200one that rejects every device but our two IDE disks. 200one that rejects every device but our two SATA disks.
201</p> 201</p>
202 202
203<pre caption="Activating LVM"> 203<pre caption="Activating LVM">
204<comment>(Avoid scanning all devices but our disks)</comment> 204<comment>(Avoid scanning all devices but our disks)</comment>
205# <i>nano -w /etc/lvm/lvm.conf</i> 205# <i>nano -w /etc/lvm/lvm.conf</i>
206<comment>(Look for the following line)</comment> 206<comment>(Look for the following line)</comment>
207 filter = [ "a/.*/" ] 207 filter = [ "a/.*/" ]
208<comment>(Replace it with the following one to scan 208<comment>(Replace it with the following one to scan
209/dev/hda and /dev/hdb and reject anything else)</comment> 209/dev/sda and /dev/sdb and reject anything else)</comment>
210 filter = [ "a|/dev/hd[ab]|", "r/.*/" ] 210 filter = [ "a|/dev/hd[ab]|", "r/.*/" ]
211<comment>(Save the file and quit nano)</comment> 211<comment>(Save the file and quit nano)</comment>
212# <i>vgscan</i> 212# <i>vgscan</i>
213 Reading all physical volumes. This may take a while... 213 Reading all physical volumes. This may take a while...
214 No volume groups found 214 No volume groups found
219<p> 219<p>
220Prepare the partitions. 220Prepare the partitions.
221</p> 221</p>
222 222
223<pre caption="Preparing the partitions"> 223<pre caption="Preparing the partitions">
224# <i>pvcreate /dev/hda4 /dev/hdb1</i> 224# <i>pvcreate /dev/sda4 /dev/sdb1</i>
225 No physical volume label read from /dev/hda4 225 No physical volume label read from /dev/sda4
226 Physical volume "/dev/hda4" successfully created 226 Physical volume "/dev/sda4" successfully created
227 No physical volume label read from /dev/hdb1 227 No physical volume label read from /dev/sdb1
228 Physical volume "/dev/hdb1" successfully created 228 Physical volume "/dev/sdb1" successfully created
229</pre> 229</pre>
230 230
231<p> 231<p>
232Setup a volume group. A volume group is the result of combining several 232Setup a volume group. A volume group is the result of combining several
233physical units into a single logical device. 233physical units into a single logical device.
234</p> 234</p>
235 235
236<p> 236<p>
237In our example, <path>/dev/hda1</path>, <path>/dev/hda2</path> and 237In our example, <path>/dev/sda1</path>, <path>/dev/sda2</path> and
238<path>/dev/hda3</path> are the <path>/boot</path>, swap and root partitions so 238<path>/dev/sda3</path> are the <path>/boot</path>, swap and root partitions so
239we need to combine <path>/dev/hda4</path> and <path>/dev/hdb1</path>. It can be 239we need to combine <path>/dev/sda4</path> and <path>/dev/sdb1</path>. It can be
240done with a single command, but, as an example, we will create our volume group 240done with a single command, but, as an example, we will create our volume group
241and extend it. 241and extend it.
242</p> 242</p>
243 243
244<pre caption="Creating and extending a volume group"> 244<pre caption="Creating and extending a volume group">
245<comment>(Create a volume group named vg)</comment> 245<comment>(Create a volume group named vg)</comment>
246# <i>vgcreate vg /dev/hda4</i> 246# <i>vgcreate vg /dev/sda4</i>
247 /etc/lvm/backup: fsync failed: Invalid argument <comment>(Ignore this warning)</comment> 247 /etc/lvm/backup: fsync failed: Invalid argument <comment>(Ignore this warning)</comment>
248 Volume group "vg" successfully created 248 Volume group "vg" successfully created
249<comment>(Extending an existing volume group)</comment> 249<comment>(Extending an existing volume group)</comment>
250# <i>vgextend vg /dev/hdb1</i> 250# <i>vgextend vg /dev/sdb1</i>
251 /etc/lvm/backup: fsync failed: Invalid argument <comment>(Ignore this warning, again and later as well)</comment> 251 /etc/lvm/backup: fsync failed: Invalid argument <comment>(Ignore this warning, again and later as well)</comment>
252 Volume group "vg" successfully extended 252 Volume group "vg" successfully extended
253</pre> 253</pre>
254 254
255<p> 255<p>
400your LVM2 logical volumes as needed. Again, here are a few lines needed for 400your LVM2 logical volumes as needed. Again, here are a few lines needed for
401our example: 401our example:
402</p> 402</p>
403 403
404<pre caption="Extract of /etc/fstab"> 404<pre caption="Extract of /etc/fstab">
405/dev/hda1 /boot ext3 noauto,noatime 1 2 405/dev/sda1 /boot ext3 noauto,noatime 1 2
406/dev/hda2 none swap sw 0 0 406/dev/sda2 none swap sw 0 0
407/dev/hda3 / ext3 noatime 0 1 407/dev/sda3 / ext3 noatime 0 1
408# Logical volumes 408# Logical volumes
409/dev/vg/usr /usr ext3 noatime 0 2 409/dev/vg/usr /usr ext3 noatime 0 2
410/dev/vg/home /home ext3 noatime 0 2 410/dev/vg/home /home ext3 noatime 0 2
411/dev/vg/opt /opt ext3 noatime 0 2 411/dev/vg/opt /opt ext3 noatime 0 2
412/dev/vg/var /var ext3 noatime 0 2 412/dev/vg/var /var ext3 noatime 0 2

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20