Difference between revisions of "Weasel disk partition plan"

From Finninday
Jump to: navigation, search
(create volume group netback on sdd)
(create logical volume netback on sdd)
Line 131: Line 131:
 
   ACTIVE            '/dev/Ubuntu/root' [226.77 GB] inherit
 
   ACTIVE            '/dev/Ubuntu/root' [226.77 GB] inherit
 
   ACTIVE            '/dev/Ubuntu/swap_1' [5.88 GB] inherit
 
   ACTIVE            '/dev/Ubuntu/swap_1' [5.88 GB] inherit
 +
 +
root@weasel:~# mkfs -t ext3 /dev/netback/netback
  
 
====move big from sdb to sdc====
 
====move big from sdb to sdc====

Revision as of 21:29, 2 July 2008

Currently I have two partitions, root and big. They are both managed by lvm and look like this:

root@weasel:/boot# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/Ubuntu-root
                      224G  107G  106G  51% /
/dev/mapper/vg00-big  230G  187G   32G  86% /big

It would be much more reasonable to have a small root partition that is easily backed up and separate partitions for /home, /store, and /big.

/store is a shared network-accessible space. /big is used for automatic backups of root, /home, and /store.

Partition Size
root 4G
store 99G
home 3.4G
var 1.2G
big 187G
Total 300G

root is 107G (root + home + var + store), so if I would split them apart, root could be as small as 4G.

It would be handy if the root partition could be kept small enough to be backed up on a DVD.

So the new scheme would have 4 physical volumes:

Device Size Use
/dev/hda 250G root, store, home, var
/dev/hdb 250G backup root, store, home, var
/dev/hdc 500G big
/dev/hdd 500G big, network backup

The main idea is to partition disk failures, so I don't want to bunch all the disks together into a single volume group. When one disk goes bad, I don't want to lose access to part of another disk just because it is in the same volume group. I'm assuming that a volume group will fail when any physical volume in that group fails.

The logical volumes should be divided into primary and backup volumes and the sizes of the two volumes should match.

There should be a primary root, store, home, var, big. And there should be an equivalent backup root, store, home, var, big.

There should also be sufficient unformatted space in the primary volume group for a snapshot of the root partition so that an image can be taken and stored offline. But if root is small, that shouldn't be a problem.

So I'll need to move big (sdb1 vg00) to a 500G drive.

The big plan

Physical volumes sda (250G) sdb (250G) sdc (500G) sdd (500G)
Volume groups Ubuntu vg00 rootback netstore netback
Logical volumes root,var,home,store,swap big rootback netstore,store netback
Percent free 57% 57% 62% 62%

Currently lvscan looks like this:

 ACTIVE            '/dev/vg00/big' [232.88 GB] inherit
 ACTIVE            '/dev/Ubuntu/root' [226.77 GB] inherit
 ACTIVE            '/dev/Ubuntu/swap_1' [5.88 GB] inherit

bring sdc and sdd online

create volume group netstore on sdc

pvcreate /dev/sdc
vgcreate netstore /dev/sdc
mkfs -t ext3 /dev/netstore/netstore

create volume group netback on sdd

pvcreate /dev/sdd
vgcreate netback /dev/sdd

create logical volume netback on sdd

Determine the number of physical extents on the volume group.

root@weasel:~# vgdisplay netback | grep "Total PE"
 Total PE              119234

Use that number to create a logical volume that consumes the disk.

root@weasel:~# lvcreate -l 119234 netback -n netback
 Logical volume "netback" created
root@weasel:~# lvscan
 ACTIVE            '/dev/netback/netback' [465.76 GB] inherit
 ACTIVE            '/dev/netstore/netstore' [465.76 GB] inherit
 ACTIVE            '/dev/vg00/big' [232.88 GB] inherit
 ACTIVE            '/dev/Ubuntu/root' [226.77 GB] inherit
 ACTIVE            '/dev/Ubuntu/swap_1' [5.88 GB] inherit
root@weasel:~# mkfs -t ext3 /dev/netback/netback

move big from sdb to sdc

mount /dev/netstore/netstore /big2
rsync -av /big/share /big2
rsync -av /big/weasel /big2
vol_id -u /dev/netstore/netstore
cd /dev/disk/by-uuid
ln -s ../../mapper/netstore-netstore 91fdcaaa-1ff7-4644-9976-10bda5f4919e

edit /etc/fstab to associate /big with the UUID for netstore

umount /big2 
umount /big
mount /big

create logical volumes for var, home, store on volume group Ubuntu

move those directories from root and mount them

leave unassigned space on volume group Ubuntu so I can grow any of those logical volumes

When done, lvscan should look like this:

/dev/Ubuntu/root
/dev/Ubuntu/swap_1
/dev/Ubuntu/var
/dev/Ubuntu/home
/dev/Ubuntu/store
/dev/rootback/rootback
/dev/netstore/netstore
/dev/netback/netback