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