07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

e clustered into one VG and the slower ones into another; chunks of the first one can then be<br />

assigned to applications requiring fast data access, while the second one will be kept for less<br />

demanding tasks.<br />

In any case, keep in mind that an LV isn't particularly attached to any one PV. It is possible to<br />

influence where the data from an LV are physically stored, but this possibility isn't required<br />

for day-to-day use. On the contrary: when the set of physical components of a VG evolves, the<br />

physical storage locations corresponding to a particular LV can be migrated across disks (while<br />

staying within the PVs assigned to the VG, of course).<br />

12.1.2.2. Seing up LVM<br />

Let us now follow, step by step, the process of setting up LVM for a typical use case: we want<br />

to simplify a complex storage situation. Such a situation usually happens after some long and<br />

convoluted history of accumulated temporary measures. For the purposes of illustration, we'll<br />

consider a server where the storage needs have changed over time, ending up in a maze of<br />

available partitions split over several partially used disks. In more concrete terms, the following<br />

partitions are available:<br />

• on the sdb disk, a sdb2 partition, 4 GB;<br />

• on the sdc disk, a sdc3 partition, 3 GB;<br />

• the sdd disk, 4 GB, in fully available;<br />

• on the sdf disk, a sdf1 partition, 4 GB; and a sdf2 partition, 5 GB.<br />

In addition, let's assume that disks sdb and sdf are faster than the other two.<br />

Our goal is to set up three logical volumes for three different applications: a file server requiring<br />

5 GB of storage space, a database (1 GB) and some space for back-ups (12 GB). The first two<br />

need good performance, but back-ups are less critical in terms of access speed. All these constraints<br />

prevent the use of partitions on their own; using LVM can abstract the physical size of<br />

the devices, so the only limit is the total available space.<br />

The required tools are in the lvm2 package and its dependencies. When they're installed, setting<br />

up LVM takes three steps, matching the three levels of concepts.<br />

First, we prepare the physical volumes using pvcreate:<br />

# pvdisplay<br />

# pvcreate /dev/sdb2<br />

Physical volume "/dev/sdb2" successfully created<br />

310 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!