Weasel disk partition plan: Difference between revisions
Line 168: | Line 168: | ||
So I'll need to unmount root, resize the filesystem, and use lvreduce to create some space for new logical volumes for /home, /store, /var. | So I'll need to unmount root, resize the filesystem, and use lvreduce to create some space for new logical volumes for /home, /store, /var. | ||
Root is a 224G device with 107G in use and 106G available. /store is about 100GB. It doesn't really belong on root. If I moved it to /big where it belongs, then root would be a total of about 10G. Then moving /home and /var should be much easier. | |||
====move those directories from root and mount them==== | ====move those directories from root and mount them==== |
Revision as of 23:07, 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 | netstore | netback | |
Logical volumes | root,var,home, |
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
{create logical volume netstore}
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
Root is on sda5, volume group Ubuntu.
root@weasel:/# pvscan PV /dev/sdd VG netback lvm2 [465.76 GB / 0 free] PV /dev/sdc VG netstore lvm2 [465.76 GB / 0 free] PV /dev/sdb1 VG vg00 lvm2 [232.88 GB / 0 free] PV /dev/sda5 VG Ubuntu lvm2 [232.64 GB / 0 free] Total: 4 [1.36 TB] / in use: 4 [1.36 TB] / in no VG: 0 [0 ]
Ubuntu does not have any free space to create a new logical volume, much less 3 new logical volumes. The first command that pops to mind is lvreduce, but according to the man page, I have to shrink the filesystem first:
DESCRIPTION lvreduce allows you to reduce the size of a logical volume. Be careful when reducing a logical volume’s size, because data in the reduced part is lost!!! You should therefore ensure that any filesystem on the volume is resized before running lvreduce so that the extents that are to be removed are not in use.
According to "man -k ext3", this looks like what I need:
resize2fs (8) - ext2/ext3 file system resizer
So I'll need to unmount root, resize the filesystem, and use lvreduce to create some space for new logical volumes for /home, /store, /var.
Root is a 224G device with 107G in use and 106G available. /store is about 100GB. It doesn't really belong on root. If I moved it to /big where it belongs, then root would be a total of about 10G. Then moving /home and /var should be much easier.
move those directories from root and mount them
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