JP Vossen on 21 May 2008 22:27:53 -0700


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

[PLUG] Mirrored drives with LVM


Got this one working, though I haven't fully explored installing grub on 
the second drive, or "yanking" a drive to see how it does.  Also, I'm 
doing my testing in VMware at the moment, with small disks, as will be 
obvious.

The goal for this one was to mirror both /boot and / (as James 
suggested), but use LVM for /.  It basically Just Worked, using the 
Ubuntu Server (or probably Alternate CD, though I didn't test that).

I believe if you use the guided partioning with LVM, it uses the entire 
disk for the volume group, then the entire volume group for the logical 
volume (Debian Etch did anyway).  THAT's BAD.  You want to leave 2-4G of 
space in the VG unused, so you can create LVM snapshots during backups.

Using Ubuntu Server CD; mirrored (/boot, /) + LVM
      Partition Method: manual
	Partition 256M as "physical volume for RAID" on both disks,
		and flag bootable
	Use the rest of each disk for "physical volume for RAID"
	"Configure Software Raid"
		Yes, to write changes
		"Create MD devices"
		RAID1 #0, then follow prompts, use 2, 0, then the
			"boot" partitions
		"Create MD devices"
		RAID1 #1, then follow prompts, use 2, 0, then the
			other partitions
	RAID1 #0, set as "ext3", /boot, label "boot"
	RAID1 #1, set as "physical volume for LVM"
	Configure the LVM
		Create volume group, name = vg_hostname
		Create logical volume
			lv_swap_1	512M
			lv_root	rest of space - e.g., 2G (to leave some
				space free for snapshots!)
	LVM VG vg_hostname, LV lv_root
		Mount as ext3 /root, label = root
	LVM VG vg_hostname, LV lv_swap_1
		Use as swap area

The final partition setup should look something like this (tested from 
in VMware):
	LVM VG vg_hostname, LV lv_root - 7.1 GB Linux device-mapper
	      #1   7.1 GB   f ext3       /
	LVM VG vg_hostname, LV lv_swap_1 - 536.8 MB Linux device-mapper
	      #1 536.9 MB   f swap       swap
	RAID1 device #0 - 254.9 MB Software RAID Device
	      #1 254.9 MB   F ext3       /boot
	RAID1 device #1 - 8.3 GB Software RAID Device
	      #1   8.3 GM   K lvm
	SCSI3 (0,0,0) (sda) - 8.6 GB VMware, VMware Virtual...
	      #1 primary  255.0 MB B K raid
	      #2 primary    8.3 GB   K raid
	SCSI3 (0,1,0) (sdb) - 8.6 GB VMware, VMware Virtual...
	      #1 primary  255.0 MB B K raid
	      #2 primary    8.3 GB   K raid

I name the volume group vg_hostname, where hostname is actually the name 
of the machine.  I then name the logical volumes lv_whatever.  lv_swap_1 
is probably overkill, but it allows for adding more swap later.  I 
picked up that convention someplace on the 'Net, but if anyone has any 
better ideas please share.  I find the vg_ and lv_ parts useful since 
the additional layers of abstraction created by LVM can get confusing, 
especially if you only ever deal with it once every couple of years, 
like I do.

Hope this is useful for someone,
JP
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|        jp{at}jpsdomain{dot}org
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug