lvm-striping/install.sh

raw link view readme
1 sudo -i
2 create ()
3 {
4 # OR USE parted -s /dev/sd$1 mklabel gpt
5 parted -s /dev/sd$1 mklabel msdos
6 parted -s /dev/sd$1 mkpart primary 1MiB 100%
7 parted -s /dev/sd$1 set 1 lvm on
8 }
9
10 create b
11 create c
12 create d
13 create e
14
15 partprobe
16
17 pvcreate /dev/sd[b-d]1
18
19 vgcreate vg_data /dev/sdb1 /dev/sdc1 /dev/sdd1
20
21 lvcreate -l +100%FREE vg_data -n lv_mongodb --stripes 3
22
23 vgcreate vg_logs /dev/sde1
24
25 lvcreate -l +100%FREE vg_logs -n lv_mongologs
26
27 mkfs.ext4 /dev/vg_data/lv_mongodb
28 mkfs.ext4 /dev/vg_logs/lv_mongologs
29
30 mkdir /var/log/mongologs
31 mkdir /var/lib/mongodb
32
33 echo "`blkid | grep lv_mongologs | awk '{ print $2 }'` /var/log/mongologs ext4 defaults,noatime 0 0" >> /etc/fstab
34 echo "`blkid | grep lv_mongodb | awk '{ print $2 }'` /var/lib/mongodb ext4 defaults,noatime 0 0" >> /etc/fstab
35
36 mount -a
37
38 for n in `seq 20`; do dd if=/dev/zero of=/var/lib/mongodb/$n-file-after.img bs=1M count=10; done
39