ADMIRAL LVM allocation
From ImageWeb
Contents |
Connecting a new logical volume for data
- Install LVM software:
apt-get install lvm2
- Using the ESX console allocate a new disk for the virtual machine
- In a terminal session, create a logical volume for the data:
- allocate a single partition occupying the entire disk:
- create a LVM physical extent on the new partition:
- create a volume group:
- create a logical volume using all the available space in the volume group:
fdisk /dev/sdb pvcreate /dev/sdb1 vgcreate vg-admiral-data /dev/sdb1 lvcreate --name lv-admiral-data --extents 100%FREE vg-admiral-data
- Now create and mount a file system on the logical volume, and create a symlink to it:
mkfs.ext3 /dev/vg-admiral-data/lv-admiral-data mkdir /mnt/lv-admiral-data mount /dev/vg-admiral-data/lv-admiral-data /mnt/lv-admiral-data/ ln -s /mnt/lv-admiral-data/ /mnt/data
- Copy and symlink existing data directory
cd /home cp -axv data/ /mnt/lv-admiral-data/ mv data data-saved ln -s /mnt/lv-admiral-data/data/ data
- Edit
/etc/fstabto add a line as follows:
/dev/vg-admiral-data/lv-admiral-data /mnt/lv-admiral-data ext3 defaults,acl 0 0
- Remount the volume to enable ACLs:
mount /mnt/lv-admiral-data/ -o remount
- Create location for home directories on the data volume:
mkdir /mnt/data/home
Connecting an existing data volume
- Install LVM software, if not already installed:
apt-get install lvm2 - Using the ESX console connect the existing data disk to the virtual machine
- In a terminal session:
- to confirm the disk details:
fdisk -l /dev/sdb - Create a mount point directory, and mount the data filesystem:
- Create a symlink if not already defined:
- to confirm the disk details:
mkdir /mnt/lv-admiral-data mount /dev/vg-admiral-data/lv-admiral-data /mnt/lv-admiral-data/ ln -s /mnt/lv-admiral-data/ /mnt/data
- Copy and symlink existing data directory
cd /home mv data data-saved ln -s /mnt/lv-admiral-data/data/ data
- Edit
/etc/fstabto add a line as follows:
/dev/vg-admiral-data/lv-admiral-data /mnt/lv-admiral-data ext3 defaults,acl 0 0
- Remount the volume to enable ACLs:
mount /mnt/lv-admiral-data/ -o remount
Procedure for using a large external datastore
The following sequence of commands was used to allocate 2-off 2Tb iSCSI-provisioned datastores to underlie a 4Tb data volume on the zoo-admiral-silk system. The original local datastore is not disconnected, and is being retained in case of future need.
Note: unlike previous versions of ADMIRAL, this configuration aims to use /mnt/data as the mounted data volume, symlinked to the actual logical volume. This allows us to have different logical volume names, hence to have both old and new data volumes accessible at the same time. This facilitates migration of data to the new volume (see final section below). This will require changes to some of the ADMIRAL configuration scripts.
I also change the file system used to ext4, which seems to be better suited to handle very large data volumes. See http://en.wikipedia.org/wiki/Ext4.
Create container partitions on the two new datastore volumes:
fdisk /dev/sdc : fdisk /dev/sdd : fdisk -l
Create a logical volume from the two datastore partitions. Note that two physical volume extents are combined into a single volume group.
pvcreate /dev/sdc1 pvcreate /dev/sdd1 pvdisplay vgcreate vg-admiral-data-ext /dev/sdc1 /dev/sdd1 vgdisplay lvcreate --name lv-admiral-data-ext --extents 100%FREE vg-admiral-data-ext lvdisplay
Create a file system on the new logical volume:
mkfs.ext4 /dev/vg-admiral-data-ext/lv-admiral-data-ext
Edit /etc/fstab to take account of the new volume. The resulting file looks like this:
# /etc/fstab: static file system information. # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/sda1 / ext3 defaults 0 0 /dev/sda2 swap swap defaults 0 0 /dev/vg-admiral-data/lv-admiral-data /mnt/lv-admiral-data ext3 defaults,acl 0 0 /dev/vg-admiral-data-ext/lv-admiral-data-ext /mnt/lv-admiral-data-ext ext4 defaults,acl 0 0
Create a mount point and mount the new volume
mkdir /mnt/lv-admiral-data-ext/ mount /mnt/lv-admiral-data-ext/ mount
Finally, create a symlink for /mnt/data, and copy data from the old volume to the new volume. (If /mnt/data already exists, remove or rename it first, or strange thinks can happen with the new symlink.)
ln -s /mnt/lv-admiral-data-ext/ /mnt/data cp -ax /mnt/lv-admiral-data/* /mnt/data ls /mnt/data

