Building an OST using Ansible (Lustre 2.x)
1 Editing the template (makeoss.j2)
- The template is, at this point in time, hard coded per file system
- Consider copying it for your file system instead of editing it.
2 Create the playbook
- Copy a playbook ending in makeosts.yml
- The playbook creates a script that will create and mount each OST (makeoss.ost$num.sh)
- It also creates a script (getfstablabels.sh) that will grep for the names of the new OSTs so you can add them to /etc/fstab
2.1 Editing the playbook
- Edit the
hosts
line to correspond to your target OSS
- Edit the number of the OST (you want them to count up across the entire lustre filesystem) in THREE PLACES:
- task name
- dest line
- variable name in with_items
- Consider doing these edits using the replace function
3 Create or add to the host-vars file
- variable
osts
is used by the template that makes getfstablabels.sh. It is a list of the devices
- each ost$num variable gives:
- the device (same as in osts, sadly redundant)
- the index (which must count up from zero across the whole file system)
- the mount point (for which we use the numbering scheme ost$ossnum-$ostnum)
3.1 Here's a sample variable definition
ost7:
- { device: /dev/sda, index: 6, mtpnt: /export/lard/ost2-1 }
4 Run the playbook
caligirl;)~/infrastructure/ansible<1044>ansible-playbook -i inventories/lard playbooks/lardoss2makeosts.yml
5 Run the scripts the playbook generates
5.1 If this is not your first go-round with the OSTs...
- You should make sure you have no partitions and delete the mount points
5.2 Run the makeoss scripts one at a time...
- Since making a mount point and mounting a directory do not include any output when they exit 0, the scripts use set -x
[root@lard-oss-2 Lustre]# sh makeoss.ost7.sh
+ mkfs.lustre --index=6 --reformat --fsname=lard '--mkfsoptions=-E stride=32,stripe-width=224 -m0' --ost --mgsnode=10.7.17.126@o2ib0 /dev/sda
Permanent disk data:
Target: lard:OST0006
Index: 6
Lustre FS: lard
Mount type: ldiskfs
Flags: 0x62
(OST first_time update )
Persistent mount opts: errors=remount-ro
Parameters: mgsnode=10.7.17.126@o2ib
device size = 53412576MB
formatting backing filesystem ldiskfs on /dev/sda
target name lard:OST0006
4k blocks 13673619456
options -m0 -J size=400 -I 256 -i 1048576 -q -O extents,uninit_bg,dir_nlink,quota,huge_file,64bit,flex_bg -G 256 -E stride=32,stripe-width=224,lazy_journal_init -F
mkfs_cmd = mke2fs -j -b 4096 -L lard:OST0006 -m0 -J size=400 -I 256 -i 1048576 -q -O extents,uninit_bg,dir_nlink,quota,huge_file,64bit,flex_bg -G 256 -E stride=32,stripe-width=224,lazy_journal_init -F /dev/sda 13673619456
Writing CONFIGS/mountdata
+ mkdir -p /export/lard/ost2-1
+ mount -t lustre /dev/sda /export/lard/ost2-1
5.3 Run getfstablabels.sh
[root@lard-oss-2 Lustre]# sh getfstablabels.sh
device /dev/sda mounted by lustre
Filesystem volume name: lard-OST0006
device /dev/sdb mounted by lustre
Filesystem volume name: lard-OST0007
device /dev/sdc mounted by lustre
Filesystem volume name: lard-OST0008
device /dev/sdd mounted by lustre
Filesystem volume name: lard-OST0009
device /dev/sde mounted by lustre
Filesystem volume name: lard-OST000a
device /dev/sdf mounted by lustre
Filesystem volume name: lard-OST000b
6 Manual tasks after the script runs
- Resume the non-ansiblized instructions at this point