-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_volume_with_lvm.sh
93 lines (67 loc) · 1.48 KB
/
setup_volume_with_lvm.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Get smartmontools
sudo yum install smartmontools
# Show all informations about drive like running hours
sudo smartctl -a /dev/sda1
sudo smartctl -t short /dev/sda1
# Partitions information from kernel
cat /proc/partitions
# Another tool for list partition information
lsblk
# list partitions on device
fdisk -l /dev/vda
# Create partition on disk
gdisk /dev/vdb
>n
>enter
>+500M
>p
>w
#Reload partition table
sudo partprobe
# 1
# Create physical volume
sudo pvcreate /dev/vdb1
# Verify pv creation
pvs
# More infromation about pv
pvdisplay
# 2
# Create RHCSA group on pv
sudo vgcreate RHCSA /dev/vdb1 # /dev/vdb2 would be possible
# Verify volume group creation
vgs
# More information vgdisplay
vgdisplay
# 3
# Create logical volume with name lvdate on RHCSA group
sudo lvcreate --name lvdata --size 495M RHCSA
#Größenangabe in z.B. Gigabyte:
lvcreate -n data -L1G vg00
# Angabe in Prozent des verfügbaren Speichers in der VG:
lvcreate -n data -l100%VG vg00
# Angabe in Prozent des freien Speichers in der VG:
lvcreate -n data -l100%FREE vg00
# Verify logical volume creation
lvs
# More information
lvdisplay
# 4 Format logical volume
sudo mkfs -t xfs /dev/RHCSA/lvdata
# Verify
blkid
# 5 Create mount point
sudo mkdir /media/lvdata
sudo mount /dev/RHCSA/lvdata /media/lvdata
# Verify
df -T
# Show mount options
mount
# 5
# Add auto mount
sudo vim /etc/fstab
/dev/RHCSA/lvdata /media/lvdata xfs defaults 0 0
# 6
# Unmount and Mount everything
unmount /media/lvdata
mount -a