Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LVM + RAID follow up

A couple years back, I upgraded the hard drives on my two home Linux servers
and, instead of tossing the old drives away, kept them in place and
reconfigured the systems for software RAID.  At the time I wrote a cookbook
how-to and posted it here.

Following up at the time of one of my mini-upgrades, I'm very happy that I set
this up with the Logical Volume Manager (LVM).  The two features make
capacity/reliability upgrades far easier:  haven't had to do a time-consuming
"major system overhaul" in a very long time, despite the huge pile of MP3s,
videos, and photos getting dumped into the servers.

* With RAID1, to add a new/bigger hard drive, you simply pluck out one of the
drives, plug in the new, create the partition table and resync.  I've been
staggering upgrades: once or twice a year, I buy whatever drive's on sale at a
price point of $50 to $80.  Half a year ago, I got a 160Gb; last month I got a
300Gb.  So my system has 160Gb available now, with "scratch storage" of 140Gb
unused which I'll put online in a few months whenever I find a cheap 500Gb

* With the LVM and the resize functions of Reiser FS, you can shift spare
capacity between different volumes.  If you keep separate volumes for, say,
photos, videos, user work files, root, tmp and a couple of others--the system
can be easier to back up.  But without LVM, you'd have to rebuild filesystems
every time one of the volumes ran out of storage.

Each time I add capacity, I wind up adding another RAID device (at this point
I have md0, md1, and md2).  This is more or less invisible at the user level
but at the administrative level it will eventually be hairy enough that I'll
want to wipe the disks and move everything to a single device md0.  The
commands to do that aren't difficult but I'll probably do that whenever I
migrate to a new Linux distro.  (Suse-10 is the one I'm using on the newer

Here's an example of what I just did to add space to my MP3 volume:

# pvdisplay -C
  PV         VG      Fmt  Attr PSize   PFree
  /dev/md0   system  lvm2 a-   110.50G 4.00G
  /dev/md1   system1 lvm2 a-    27.17G 2.05G
  /dev/md2   system2 lvm2 a-    11.26G 4.26G
# lvextend --size +2.5G /dev/system/volmp3
  Extending logical volume volmp3 to 91.00 GB
  Logical volume volmp3 successfully resized
# resize_reiserfs /dev/system/volmp3
resize_reiserfs 3.6.18 (2003
resize_reiserfs: On-line resizing finished successfully.

The Reiser resize function can add space without dismounting.  If you need to
reduce a volume's size to make room for another, you'll need to umount the
volume first, then issue the resize (specifying how much to remove, e.g.
"resize_reiserfs -s -2G /dev/vol"), then issue the lvreduce command.

One other hint I'll give, that was missing from my early posts on this topic: 
install the sysstat package from your distro, so you get access to iostat. 
The command "iostat -k -d 5" will show disk I/O activity at 5-second
intervals.  (There's probably a graphical program to do the same thing, but
I've yet to discover it.)  You can use this to confirm performance of software
vs. hardware RAID or various disk drives, network cards and applications if
you have the resources available.  For example, it will show a (roughly) 50-50
split of I/O reads from the two devices in a RAID1 volume if the drives are
similar in performance (nice that simple software RAID can literally double
your disk throughput using cheap drives!); if one drive is sluggish, you'll
see the problem right away.


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /