Difference between pages "Learning Linux LVM, Part 1" and "Test"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
{{Article
{{#get_web_data:url=http://build.funtoo.org/index.xml|format=xml|use xpath|data=builds=/subarches/subarch[@name='amd64-bulldozer']/@builds}}
|Subtitle=Storage management magic with Logical Volume Management
;Builds: {{#external_value:builds}}
|Author=Drobbins
}}
== LVM intro ==


In this series, I'm going to show you how to install and use the new Logical Volume Management support built-in to the Linux kernel. If you've never used a form of LVM before, you're in for a treat; it's a wonderful technology. Before we actually get LVM up and running, I'm going to explain exactly what it is and how it works. Then, we'll be ready to test out LVM and get the most out of it.
asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf
<div style="align: center;"><div style="border: 1px solid #ccc; border-radius: 5px;">
[[{{#show: Organization:Brownrice Internet| ?Logo|link=none}}|350px|class=img-responsive|link=Organization:Brownrice Internet]]</div><br/>
[[Organization:Brownrice Internet|Learn about Funtoo-friendly organization: Brownrice Internet]]</div>
asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf
{{fullurl:News:The Many Builds of Funtoo Linux}}
{{#widget:AddThis}}


If you're like me, then your experience with UNIX and Linux began on a PC platform, rather than on large, commercial UNIX servers and workstations. On the basic PC, we've always had to deal with partitioning our hard drives. PC people are generally well-acquainted with tools such as fdisk, which are used to create and delete primary and extended partitions on hard disks. Hard disk partitioning is an annoying but accepted part of the process of getting an operating system up and running.
I like the {{f|/etc/make.conf}} file, which can also be referred to as {{f|/etc/portage/make.conf}}. It is a groovy file. Another cool file is {{f|/etc/fstab}}.


Hard drive partitioning can be annoying because to do a good job you really need to accurately estimate how much space you'll need for each partition. If you make a poor estimation, your Linux system could possibly be crippled -- to fix the problem, it's possible that you might even need to perform a full system backup, wipe your hard drives clean, and then restore all your data to a new (and presumably better) partition layout. Ick! These are exactly the kinds of situations that sysadmins try their best to avoid in the first place.
=== make.conf mentions ===


While partitions were once static storage regions, thankfully, we now have a proliferation of PC repartitioning tools (PowerQuest's Partition Magic product is one of the most popular). These tools allow you to boot your system with a special disk and dynamically resize your partitions and filesystems. Once you reboot, you have newly resized partitions, hopefully getting you out of your storage crunch. These partition resizing tools are great and solve the problem storage management for some. But are they perfect? Not exactly.
{{#ask: [[Mentions file::make.conf]]
 
| format=category
Tools like Partition Magic are great for workstations, but aren't really adequate for servers. First of all, they require you to reboot your system. This is something most sysadmins desperately try to avoid doing. What if you simply can't reboot your machine every time your storage needs change, such as if your storage needs change dramatically on a weekly basis? What happens if you need to expand a filesystem so that it spans more than one hard drive, or what do you do if you need to dynamically expand or shrink a volume's storage capacity while allowing Apache to continue to serve Web pages? In a highly available, dynamic environment, a basic partition resizer just won't work. For these and other situations, Logical Volume Management is an excellent (if not perfect) solution.
}}
 
== Enter LVM ==
 
Now, let's take a look at how LVM solves these problems. To create an LVM logical volume, we follow a three-step process. First, we need to select the physical storage resources that are going to be used for LVM. Typically, these are standard partitions but can also be Linux software RAID volumes that we've created. In LVM terminology, these storage resources are called "physical volumes". Our first step in setting up LVM involves properly initializing these partitions so that they can be recognized by the LVM system. This involves setting the correct partition type if we're adding a physical partition, and running the pvcreate command.
 
Once we have one or more physical volumes initialized for use by LVM, we can move on to step two -- creating a volume group. You can think of a volume group as a pool of storage that consists of one or more physical volumes. While LVM is running, we can add physical volumes to the volume group or even remove them. However, we can't mount or create filesystems on a volume group directly. Instead, we can tell LVM to create one or more "logical volumes" using our volume group storage pool:
 
[[File:l-lvm-1.gif|frame|A volume group is created out of physical volumes]]
 
Creating an LVM logical volume is really easy, and once it's created we can go ahead and put a filesystem on it, mount it, and start using the volume to store our files. To create a logical volume, we use the lvcreate command, specifying the name of our new volume, the size we'd like the volume to be, and the volume group that we'd like this particluar logical volume to be part of. The LVM system will then allocate storage from the volume group we specify and create our new volume, which is now ready for use. Once created, we can put an ext2 or ReiserFS filesystem on it, mount it, and use it as we like.
 
[[File:l-lvm-2.gif|frame|Creating two logical volumes from our existing volume group]]
 
== Extents ==
 
Behind the scenes, the LVM system allocates storage in equal-sized "chunks", called extents. We can specify the particular extent size to use at volume group creation time. The size of an extent defaults to 4Mb, which is perfect for most uses. One of the beauties of LVM is that the physical storage locations of the extents used for one of our logical volumes (in other words, what disk they're stored on) can be dynamically changed while our logical volume is mounted and in use! The LVM system ensures that our logical volumes continue to operate perfectly while allowing the administrator to physically change where everything is stored.
 
Of course, since everything is created out of equally-sized extents, it's really easy to allocate some additional extents for an already-existing logical volume -- in other words, dynamically "grow" the volume:
 
[[File:l-lvm-3.gif|frame|Adding additional extents from our volume group, expanding the size of our logical volume.]]
 
Once the logical volume has been expanded, you can then expand your ext2 or ReiserFS filesystem to take advantage of this new space. If you use a program such as resize_reiserfs, this filesystem expansion can also happen while the volume is mounted and being used! Truly amazing -- with LVM and online filesystem expansion utilties, it's no longer necessary to reboot your system or even drop to runlevel 1 to change your storage configuration.
 
The only time you need to shut down your system is when you need to add new physical disks. Once new disks have been added, you then can add these new physical volumes to your volume group(s) to create a fresh supply of extents.
 
== Setting up LVM ==
 
OK, let's get LVM installed. LVM consists of two parts: a kernel part and a suite of user-space tools. You may already have LVM support available on your system, and if not, it's a simple matter to install the appropriate tools using your distribution's package manager. On Gentoo or Funtoo Linux, this is done as follows:
 
<console>
# ##i##emerge sys-fs/lvm2
</console>
 
If you compiled your kernel manually, you'll want to reconfigure and compile your kernel so that LVM support is enabled.
 
<console>
# ##i##cd /usr/src/linux
# ##i##make menuconfig
</console>
 
You'll find the LVM options under the "Multiple devices driver support (RAID and LVM)" section, under "Device Drivers":


{{kernelop|title=Device Drivers,Multiple devices driver support (RAID and LVM)|desc=
{{console|body=
--- Multiple devices driver support (RAID and LVM)                   
# ##i##bluetoothctl
{M}  RAID support                                                   
[##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default]
<M>    Linear (append) mode                                         
##bl##[bluetooth]##!bl###power on
<M>    RAID-0 (striping) mode                                       
Changing power on succeeded
-M-    RAID-1 (mirroring) mode                                       
##bl##[bluetooth]##!bl### ##i##agent on
-M-    RAID-10 (mirrored striping) mode                             
Agent registered
-M-    RAID-4/RAID-5/RAID-6 mode                                     
##bl##[bluetooth]##!bl### ##i##scan on
<M>    Multipath I/O support                                         
Discovery started
<M>    Faulty test module for MD                                     
##bl##[bluetooth]##!bl### ##i##devices
<M>  Block device as cache                                           
Device 00:1F:20:3D:1E:75 Logitech K760
[ ]     Bcache debugging                                             
##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75
[ ]     Debug closures                                               
Attempting to pair with 00:1F:20:3D:1E:75
<M>  Device mapper support                                           
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
[ ]     Device mapper debugging support                               
##r##[agent]##!r## Passkey: 454358
[ ]     Keep stack trace of persistent data block lock holders       
##r##[agent]##!r## Passkey: ##i##4##!i##54358
<M>    Crypt target support                                         
##r##[agent]##!r## Passkey: ##i##45##!i##4358
<M>    Snapshot target                                               
##r##[agent]##!r## Passkey: ##i##454##!i##358
<M>    Thin provisioning target                                     
##r##[agent]##!r## Passkey: ##i##4543##!i##58
<M>    Cache target (EXPERIMENTAL)                                   
##r##[agent]##!r## Passkey: ##i##45435##!i##8
<M>      MQ Cache Policy (EXPERIMENTAL)                             
##r##[agent]##!r## Passkey: ##i##454358##!i##
<M>      Cleaner Cache Policy (EXPERIMENTAL)                         
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes
<M>    Era target (EXPERIMENTAL)                                     
Pairing successful
<M>    Mirror target                                                 
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no
<M>      Mirror userspace logging                                   
##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75
<M>    RAID 1/4/5/6/10 target                                       
Attempting to connect to 00:1F:20:3D:1E:75
<M>    Zero target                                                   
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
<M>    Multipath target                                             
Connection successful
<M>      I/O Path Selector based on the number of in-flight I/Os     
##bl##[bluetooth]##!bl### ##i##quit
<M>      I/O Path Selector based on the service time                 
[##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default]
<M>    I/O delaying target                                           
#
[*]     DM uevents                                                   
<M>    Flakey target                                                 
<M>    Verity target support                                         
<M>    Switch target support (EXPERIMENTAL)                         
}}
}}
I recommend enabling all features. Also ensure that LVM is enabled for your initramfs. Remember that if you are putting any main filesystems on LVM, you will need LVM compiled into your kernel, rather than a module, or you'll need an LVM-aware initramfs.
Also be sure to enable any necessary startup scripts to initialize LVM. On many distributions, including Funtoo Linux, this is done for you, provided that sufficient kernel support is available. The basic commands that these scripts will run are the following, at boot:
<console>
/sbin/vgscan
/sbin/vgchange -a y
</console>
These lines will scan for all available volume groups and activate them. At shutdown, something like this will run:
<console>
/sbin/vgchange -a n
</console>
While this stuff is handled for you automatically, if you ever boot from a rescue CD or USB stick, you may need to type {{c|vgscan}} and {{c|vgchange -a y}} as root before your logical volumes are available for use.
That's it for this article. Next article, I'll show you how to create your own logical volumes and unleash the power of LVM. I'll see you then!
{{ArticleFooter}}

Revision as of 15:22, January 12, 2015

Exception parsing XML: String could not be parsed as XML.

Builds

asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf

[[{{#show: Organization:Brownrice Internet| ?Logo|link=none}}|350px|class=img-responsive|link=Organization:Brownrice Internet]]

Learn about Funtoo-friendly organization: Brownrice Internet

asdflk asdlfk asdlf alsdf lasd flasd flasd flasd flasd flasd flasd flas dflasd flasdl flasdf lasdfl alsdf lasdf lasdflafsd la sdf https://www.funtoo.org/News:The_Many_Builds_of_Funtoo_Linux

I like the /etc/make.conf file, which can also be referred to as /etc/portage/make.conf. It is a groovy file. Another cool file is /etc/fstab.

make.conf mentions

{{#ask: Mentions file::make.conf | format=category }}

root # bluetoothctl 
[NEW] Controller 00:02:72:C9:62:65 antec [default]
root ##bl##[bluetooth]##!bl###power on
Changing power on succeeded
root ##bl##[bluetooth]##!bl### agent on
Agent registered
root ##bl##[bluetooth]##!bl### scan on
Discovery started
root ##bl##[bluetooth]##!bl### devices
Device 00:1F:20:3D:1E:75 Logitech K760
root ##bl##[bluetooth]##!bl### pair 00:1F:20:3D:1E:75
Attempting to pair with 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
[CHG] Device 00:1F:20:3D:1E:75 Paired: yes
Pairing successful
[CHG] Device 00:1F:20:3D:1E:75 Connected: no
root ##bl##[bluetooth]##!bl### connect 00:1F:20:3D:1E:75
Attempting to connect to 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
Connection successful
root ##bl##[bluetooth]##!bl### quit
[DEL] Controller 00:02:72:C9:62:65 antec [default]
root #