This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
master-2-lustre_fs.sh
72 lines (61 loc) · 1.89 KB
/
master-2-lustre_fs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
####################################################
# Install Lustre Kernel Modules and Setup Filesystem
####################################################
# Install modules into the now running lustre kernel
yum -y --nogpgcheck --enablerepo=lustre-server install \
kmod-lustre \
kmod-lustre-osd-ldiskfs \
lustre-osd-ldiskfs-mount \
lustre \
lustre-resource-agents
# Enable and start lustre & lnet
systemctl enable lustre
systemctl start lustre
systemctl enable lnet
systemctl start lnet
# Setup our lnet network
if ! lnetctl ping master; then
lnetctl net add --net tcp0 --if eth1
lnetctl export > /etc/lnet.conf
fi
# Format the lustre volumes - don't try if they are mounted :-) (re-provision)
if ! mountpoint -q /mgs; then
mkfs.lustre --reformat --fsname=lustre1 --mgs /dev/sdc
fi
if ! mountpoint -q /mdt; then
mkfs.lustre --reformat --fsname=lustre1 --mgsnode=master@tcp0 --mdt --index=0 /dev/sdd
fi
if ! mountpoint -q /ost; then
mkfs.lustre --reformat --mgsnode=master@tcp0 --fsname=lustre1 --ost --index=0 /dev/sde
fi
# Setup mounts & mount them
mkdir -p /mgs /mdt /ost
if ! grep -q "mgs" /etc/fstab; then
echo "/dev/sdc /mgs lustre defaults_netdev 0 0" >> /etc/fstab
fi
if ! grep -q "mdt" /etc/fstab; then
echo "/dev/sdd /mdt lustre defaults_netdev 0 0" >> /etc/fstab
fi
if ! grep -q "ost" /etc/fstab; then
echo "/dev/sde /ost lustre defaults_netdev 0 0" >> /etc/fstab
fi
if ! mountpoint -q /mgs; then
mount /mgs
fi
if ! mountpoint -q /mdt; then
mount /mdt
fi
if ! mountpoint -q /ost; then
mount /ost
fi
# Mount the filesystem to our own host
mkdir -p /lustre
if ! grep -q "/lustre" /etc/fstab; then
echo "master@tcp0:/lustre1 /lustre lustre defaults_netdev 0 0" >> /etc/fstab
fi
if ! mountpoint -q /lustre; then
mount /lustre
fi
# Make perms wide open on it
chmod 777 /lustre