lvm-ext4/install.sh

raw link view readme
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_core /dev/sdb1 /dev/sdc1 /dev/sdd1
19
20 lvcreate -L 20G vg_core -n lv_mongologs
21 lvcreate -l +50%FREE vg_core -n lv_mongodb
22
23 mkfs.ext4 /dev/vg_core/lv_mongologs
24 mkfs.ext4 /dev/vg_core/lv_mongodb
25
26 mkdir /var/log/mongologs
27 mkdir /var/lib/mongodb
28
29 echo "`blkid | grep lv_mongologs | awk '{ print $2 }'` /var/log/mongologs ext4 defaults,noatime 0 0" >> /etc/fstab
30 echo "`blkid | grep lv_mongodb | awk '{ print $2 }'` /var/lib/mongodb ext4 defaults,noatime 0 0" >> /etc/fstab
31
32 mount -a
33
34
35 # add some space to lv_mongologs
36
37 lvextend -L +10G /dev/vg_core/lv_mongologs
38
39 resize2fs /dev/vg_core/lv_mongologs
40
41
42 # use rest of space (previously was 50%) for lv_mongo
43
44 lvextend -l +100%FREE /dev/vg_core/lv_mongodb
45
46 resize2fs /dev/vg_core/lv_mongodb
47
48
49 # add disk and use it all
50
51 pvcreate /dev/sde1
52
53 vgextend /dev/vg_core /dev/sde1
54
55 lvextend -l +100%FREE /dev/vg_core/lv_mongodb
56
57 resize2fs /dev/vg_core/lv_mongodb
58