Difference between revisions for lvm





Next edit →

Merge of Version1 & Version2
102 mount /opt/dnl/
103 %%
104
105 == reduce ==
106
107 %%
108 # df -h /opt/
109
110 Filesystem Size Used Avail Use% Mounted on
111 /dev/mapper/vg_xps-lv_optfs 69G 44G 23G 66% /opt
112
113 %%
114
115
116 The goal is to reduce from 70G to 50G
117
118
119 ==== umount ====
120
121 %%
122 # umount /opt/
123 %%
124
125 ==== check filesystem ====
126
127 check a Linux ext2/ext3/ext4 file system
128
129 %%
130 # e2fsck -ff /dev/mapper/vg_xps-lv_optfs
131
132
133 e2fsck 1.43.9 (8-Feb-2018)
134 Pass 1: Checking inodes, blocks, and sizes
135 Pass 2: Checking directory structure
136 Pass 3: Checking directory connectivity
137 Pass 4: Checking reference counts
138 Pass 5: Checking group summary information
139 optfs: 117811/4587520 files (0.4% non-contiguous), 11609065/18350080 blocks
140 %%
141
142 ==== resize2fs filesystem ====
143
144 resize2fs - ext2/ext3/ext4 file system resizer
145
146 %%
147 # resize2fs /dev/mapper/vg_xps-lv_optfs 50G
148
149 resize2fs 1.43.9 (8-Feb-2018)
150 Resizing the filesystem on /dev/mapper/vg_xps-lv_optfs to 13107200 (4k) blocks.
151 The filesystem on /dev/mapper/vg_xps-lv_optfs is now 13107200 (4k) blocks long.
152
153 %%
154
155 ==== LVM reduce ====
156
157
158 %%
159 # lvreduce -L -20G /dev/mapper/vg_xps-lv_optfs
160   WARNING: Reducing active logical volume to 50.00 GiB.
161   THIS MAY DESTROY YOUR DATA (filesystem etc.)
162
163 Do you really want to reduce vg_xps/lv_optfs? [y/n]: y
164
165   Size of logical volume vg_xps/lv_optfs changed from 70.00 GiB (17920 extents) to 50.00 GiB (12800 extents).
166   Logical volume vg_xps/lv_optfs successfully resized.
167
168 %%
169
170 ==== verify ====
171
172 %%
173
174 # mount /opt/
175
176 # df -h /opt/
177
178 Filesystem Size Used Avail Use% Mounted on
179 /dev/mapper/vg_xps-lv_optfs 50G 44G 3.6G 93% /opt
180
181 %%
182
183 == resize to 100% ==
184
185 %%(bash)
186 # lvresize -l +100%FREE -n /dev/vg01/backup
187 %%
188
189
190 === resize xfs ===
191
192 ==== LVM resize ====
193
194 %%
195
196 # lvresize -l +100%FREE -n /dev/vg_xps/lv_Breach
197
198   Size of logical volume vg_xps/lv_Breach changed from 5.00 GiB (1280 extents) to <6.97 GiB (1784 extents).
199   Logical volume vg_xps/lv_Breach successfully resized.
200
201 %%
202
203 ==== xfs grow ====
204
205
206 %%
207
208 # xfs_growfs /opt/Breach
209
210 %%
211
212