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.16 2005/10/03 22:49:15 rane Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/lvm2.xml,v 1.17 2006/01/20 11:42:43 neysx Exp $ --> |
3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
4 | |
4 | |
5 | <guide link = "/doc/en/lvm2.xml"> |
5 | <guide link="/doc/en/lvm2.xml"> |
6 | <title>Gentoo LVM2 installation</title> |
6 | <title>Gentoo LVM2 installation</title> |
7 | |
7 | |
8 | <author title="Author"> |
8 | <author title="Author"> |
9 | <mail link="avi@CFFtechnologies.com">Avi Schwartz</mail> |
9 | <mail link="avi@CFFtechnologies.com">Avi Schwartz</mail> |
10 | </author> |
10 | </author> |
… | |
… | |
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>2.0.11</version> |
27 | <version>2.1</version> |
28 | <date>2005-08-17</date> |
28 | <date>2006-01-20</date> |
29 | |
29 | |
30 | <chapter> |
30 | <chapter> |
31 | <title>Introduction</title> |
31 | <title>Introduction</title> |
32 | <section> |
32 | <section> |
33 | <body> |
33 | <body> |
… | |
… | |
60 | <p> |
60 | <p> |
61 | If you do a fresh install of Gentoo, you will need to use a bootable CD with |
61 | If you do a fresh install of Gentoo, you will need to use a bootable CD with |
62 | LVM2 support such as a Gentoo Installation CD. You can find the Installation CDs for an x86 |
62 | LVM2 support such as a Gentoo Installation CD. You can find the Installation CDs for an x86 |
63 | architecture on our <uri |
63 | architecture on our <uri |
64 | link="/main/en/mirrors.xml">mirrors</uri> under |
64 | link="/main/en/mirrors.xml">mirrors</uri> under |
65 | <path>/releases/x86/2005.1/installcd</path>. Other architectures might |
65 | <path>/releases/x86/2005.1-r1/installcd</path>. Other architectures might |
66 | be supported as well. |
66 | be supported as well. |
67 | </p> |
67 | </p> |
68 | |
68 | |
69 | <p> |
69 | <p> |
70 | If you install LVM2 on a currently running system with some spare hard disk |
70 | If you install LVM2 on a currently running system with some spare hard disk |
… | |
… | |
132 | mentioned above as an example. It is only <e>an example</e>, adapt it to your |
132 | mentioned above as an example. It is only <e>an example</e>, adapt it to your |
133 | own needs. |
133 | own needs. |
134 | </p> |
134 | </p> |
135 | |
135 | |
136 | <p> |
136 | <p> |
137 | Create a small physical /boot partition (hda1). In this example, /boot will be |
137 | Create a small physical <path>/boot</path> partition (hda1). In this example, |
138 | not managed by LVM2. This partition will contain your bootloader and your |
138 | <path>/boot</path> will be not managed by LVM2. This partition will contain |
139 | kernel(s). A 64MB partition should be well enough for quite a few kernel |
139 | your bootloader and your kernel(s). A 64MB partition should be well enough for |
140 | generations. |
140 | quite a few kernel generations. |
141 | </p> |
|
|
142 | |
|
|
143 | <p> |
141 | </p> |
144 | Create a swap partition (hda2) and activate it. |
142 | |
145 | </p> |
143 | <p> |
146 | |
144 | Create a swap partition (hda2). |
147 | <pre caption="Activating the swap partition"> |
|
|
148 | # <i>mkswap /dev/hda2</i> |
|
|
149 | # <i>swapon /dev/hda2</i> |
|
|
150 | </pre> |
145 | </p> |
151 | |
146 | |
152 | <p> |
147 | <p> |
153 | Create a / (root) partition (hda3). If you are interested in trying to put your |
148 | Create a / (root) partition (hda3). If you are interested in trying to put your |
154 | root partition under LVM management (which we do not recommend), see the |
149 | root partition under LVM management (which we do not recommend), see the |
155 | resources section at the end of this guide for a link to a mini-howto on how to |
150 | resources section at the end of this guide for a link to a mini-howto on how to |
… | |
… | |
165 | This way, you would still be able to log into your system (crippled, but |
160 | This way, you would still be able to log into your system (crippled, but |
166 | still somewhat usable, as root) if something goes terribly wrong. |
161 | still somewhat usable, as root) if something goes terribly wrong. |
167 | </note> |
162 | </note> |
168 | |
163 | |
169 | <p> |
164 | <p> |
170 | Assuming the /boot, swap and root partitions do not use the whole physical disk, |
165 | Assuming the <path>/boot</path>, swap and root partitions do not use the whole |
171 | create a fourth partition on this disk and set it to type 8e (Linux LVM). |
166 | physical disk, create a fourth partition on this disk and set it to type 8e |
172 | If you have more physical drives you would like to use with LVM, create |
167 | (Linux LVM). If you have more physical drives you would like to use with LVM, |
173 | one partition on each and give them the same type (8e). |
168 | create one partition on each and give them the same type (8e). |
174 | </p> |
169 | </p> |
175 | |
170 | |
176 | <note> |
171 | <note> |
177 | Considering the huge size of current disks, you might consider splitting your |
172 | Considering the huge size of current disks, you might consider splitting your |
178 | hard disks into smaller partitions instead of creating a big partition that |
173 | hard disks into smaller partitions instead of creating a big partition that |
… | |
… | |
182 | until you know you need it. As an example, one contributor had split his |
177 | until you know you need it. As an example, one contributor had split his |
183 | 160 Gb hard disk into 8 partitions of 20 Gb each. |
178 | 160 Gb hard disk into 8 partitions of 20 Gb each. |
184 | </note> |
179 | </note> |
185 | |
180 | |
186 | <p> |
181 | <p> |
|
|
182 | Create the filesystems on <path>/dev/hda1</path> and <path>/dev/hda3</path>, |
|
|
183 | and create and activate the swap on <path>/dev/hda2</path> as described in the |
|
|
184 | handbook. |
|
|
185 | </p> |
|
|
186 | |
|
|
187 | <p> |
187 | Load the LVM2 <path>dm-mod</path> module. |
188 | Load the LVM2 <path>dm-mod</path> module. |
188 | </p> |
189 | </p> |
189 | |
190 | |
190 | <pre caption="Loading the LVM2 module"> |
191 | <pre caption="Loading the LVM2 module"> |
191 | # <i>modprobe dm-mod</i> |
192 | # <i>modprobe dm-mod</i> |
192 | </pre> |
193 | </pre> |
193 | |
194 | |
194 | <p> |
195 | <p> |
195 | Scan and activate LVM: |
196 | Before scanning and activating LVM, you might want to edit |
|
|
197 | <path>/etc/lvm/lvm.conf</path> to exclude some devices. By default, LVM2 will |
|
|
198 | scan all devices, even your CDROM which can generate error messages. In the |
|
|
199 | following exemple, the line that allows scanning of all devices is replaced by |
|
|
200 | one that rejects every device but our two IDE disks. |
196 | </p> |
201 | </p> |
197 | |
202 | |
198 | <pre caption="Activating LVM"> |
203 | <pre caption="Activating LVM"> |
199 | <comment>(Avoid scanning your cdrom)</comment> |
204 | <comment>(Avoid scanning all devices but our disks)</comment> |
200 | # <i>mkdir -p /etc/lvm</i> |
205 | # <i>nano -w /etc/lvm/lvm.conf</i> |
201 | # <i>echo 'devices { filter=["r/cdrom/"] }' >/etc/lvm/lvm.conf</i> |
206 | <comment>(Look for the following line)</comment> |
|
|
207 | filter = [ "a/.*/" ] |
|
|
208 | <comment>(Replace it with the following one to scan |
|
|
209 | /dev/hda and /dev/hdb and reject anything else)</comment> |
|
|
210 | filter = [ "a|/dev/hd[ab]|", "r/.*/" ] |
|
|
211 | <comment>(Save the file and quit nano)</comment> |
202 | # <i>vgscan</i> |
212 | # <i>vgscan</i> |
203 | Reading all physical volumes. This may take a while... |
213 | Reading all physical volumes. This may take a while... |
204 | No volume groups found |
214 | No volume groups found |
205 | <comment>(Make any previously set up volume groups available)</comment> |
215 | <comment>(Make any previously set up volume groups available)</comment> |
206 | # <i>vgchange -a y</i> |
216 | # <i>vgchange -a y</i> |
… | |
… | |
387 | <path>/usr/src/linux/include/linux</path>. |
397 | <path>/usr/src/linux/include/linux</path>. |
388 | </impo> |
398 | </impo> |
389 | |
399 | |
390 | <pre caption="Emerging the LVM2 package"> |
400 | <pre caption="Emerging the LVM2 package"> |
391 | # <i>emerge lvm2</i> |
401 | # <i>emerge lvm2</i> |
392 | <comment>(At the time of writing, the stable version is 2.00.08. |
402 | </pre> |
393 | With version 2.00.08, prevent lvm2 from probing your cdrom by doing:</comment> |
|
|
394 | # <i>echo 'devices { filter=["r/cdrom/"] }' >> /etc/lvm/lvm.conf</i> |
|
|
395 | |
403 | |
396 | <comment>(Versions 2.00.15 and later come with a /etc/lvm/lvm.conf |
404 | <p> |
397 | Edit your /etc/lvm/lvm.conf and follow the comments</comment> |
405 | Edit <path>/etc/lvm/lvm.conf</path> as described <uri |
398 | # <i>nano -w /etc/lvm/lvm.conf</i> |
406 | link="#doc_chap2_pre2">earlier</uri>. The file you previously edited is part of |
|
|
407 | your installation environment and will disappear after the next reboot. This |
|
|
408 | time, you edit the real one inside your new Gentoo install. |
399 | </pre> |
409 | </p> |
400 | |
410 | |
401 | <p> |
411 | <p> |
402 | When editing your <path>/etc/fstab</path> file, follow the handbook and add |
412 | When editing your <path>/etc/fstab</path> file, follow the handbook and add |
403 | your LVM2 logical volumes as needed. Again, here are a few lines needed for |
413 | your LVM2 logical volumes as needed. Again, here are a few lines needed for |
404 | our example: |
414 | our example: |
… | |
… | |
479 | </li> |
489 | </li> |
480 | <li> |
490 | <li> |
481 | The <uri link="http://tldp.org/HOWTO/LVM-HOWTO">LVM Howto</uri> |
491 | The <uri link="http://tldp.org/HOWTO/LVM-HOWTO">LVM Howto</uri> |
482 | </li> |
492 | </li> |
483 | <li> |
493 | <li> |
484 | Daniel Robbins's articles on LVM at IBM's DeveloperWorks: |
494 | Daniel Robbins's articles on LVM for IBM's DeveloperWorks: <uri |
485 | <uri>http://www-106.ibm.com/developerworks/linux/library/l-lvm/?dwzone=linux</uri> |
495 | link="/doc/en/articles/lvm-p1.xml">Part 1</uri> and <uri |
486 | and |
496 | link="/doc/en/articles/lvm-p2.xml">Part 2</uri> |
487 | <uri>http://www-106.ibm.com/developerworks/linux/library/l-lvm2.html?dwzone=linux</uri> |
|
|
488 | </li> |
497 | </li> |
489 | <li> |
498 | <li> |
490 | How to boot your root FS off of LVM1: |
499 | How to boot your root FS off of LVM1: |
491 | <uri>http://www.the-infinite.org/archive/docs/lvm/howto-boot-off-root-lv.txt</uri> |
500 | <uri>http://www.the-infinite.org/archive/docs/lvm/howto-boot-off-root-lv.txt</uri> |
492 | </li> |
501 | </li> |