1 |
{ |
2 |
# OR USE parted -s /dev/sd$1 mklabel gpt |
3 |
parted -s /dev/sd$1 mklabel msdos |
4 |
parted -s /dev/sd$1 mkpart primary 1MiB 100% |
5 |
parted -s /dev/sd$1 set 1 lvm on |
6 |
} |
7 |
|
8 |
create b |
9 |
create c |
10 |
create d |
11 |
create e |
12 |
|
13 |
partprobe |
14 |
|
15 |
pvcreate /dev/sd[b-d]1 |
16 |
|
17 |
vgcreate vg_core /dev/sdb1 /dev/sdc1 /dev/sdd1 |
18 |
|
19 |
lvcreate -L 20G vg_core -n lv_mongologs |
20 |
lvcreate -l +50%FREE vg_core -n lv_mongodb |
21 |
|
22 |
mkfs.ext4 /dev/vg_core/lv_mongologs |
23 |
mkfs.ext4 /dev/vg_core/lv_mongodb |
24 |
|
25 |
mkdir /var/log/mongologs |
26 |
mkdir /var/lib/mongodb |
27 |
|
28 |
echo "`blkid | grep lv_mongologs | awk '{ print $2 }'` /var/log/mongologs ext4 defaults,noatime 0 0" >> /etc/fstab |
29 |
echo "`blkid | grep lv_mongodb | awk '{ print $2 }'` /var/lib/mongodb ext4 defaults,noatime 0 0" >> /etc/fstab |
30 |
|
31 |
mount -a |
32 |
|
33 |
|
34 |
# add some space to lv_mongologs |
35 |
|
36 |
lvextend -L +10G /dev/vg_core/lv_mongologs |
37 |
|
38 |
resize2fs /dev/vg_core/lv_mongologs |
39 |
|
40 |
|
41 |
# use rest of space (previously was 50%) for lv_mongo |
42 |
|
43 |
lvextend -l +100%FREE /dev/vg_core/lv_mongodb |
44 |
|
45 |
resize2fs /dev/vg_core/lv_mongodb |
46 |
|
47 |
|
48 |
# add disk and use it all |
49 |
|
50 |
pvcreate /dev/sde1 |
51 |
|
52 |
vgextend /dev/vg_core /dev/sde1 |
53 |
|
54 |
lvextend -l +100%FREE /dev/vg_core/lv_mongodb |
55 |
|
56 |
resize2fs /dev/vg_core/lv_mongodb |
57 |
|