Difference between revisions for lvm




← Previous edit
Next edit →

Version1 Version2 Differences
102 102 mount /opt/dnl/
103 103 %%
104 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  
105 183 == resize to 100% ==
106 184
107 185 %%(bash)
… … …
127 205
128 206 %%
129 207
  208 # mount /opt/Breach  
  209  
  210 # df -h /opt/Breach  
  211  
  212 Filesystem Size Used Avail Use% Mounted on  
  213 /dev/mapper/vg_xps-lv_Breach 7.0G 7.0G 15M 100% /opt/Breach  
  214  
  215 %%  
  216  
  217 %%  
  218  
130 219 # xfs_growfs /opt/Breach
131 220
132   %%
133  
134  
  221 meta-data=/dev/mapper/vg_xps-lv_Breach isize=512 agcount=6, agsize=327680 blks
  222          = sectsz=512 attr=2, projid32bit=1
  223          = crc=1 finobt=1 spinodes=0 rmapbt=0
  224          = reflink=0
  225 data = bsize=4096 blocks=1826816, imaxpct=25
  226          = sunit=0 swidth=0 blks
  227 naming =version 2 bsize=4096 ascii-ci=0 ftype=1
  228 log =internal bsize=4096 blocks=2560, version=2
  229          = sectsz=512 sunit=0 blks, lazy-count=1
  230 realtime =none extsz=4096 blocks=0, rtextents=0
  231 data blocks changed from 1826816 to 7069696
  232
  233 %%
  234
  235 %%
  236
  237 # df -h /opt/Breach
  238 Filesystem Size Used Avail Use% Mounted on
  239 /dev/mapper/vg_xps-lv_Breach 27G 7.0G 20G 26% /opt/Breach
  240
  241 %%
  242
  243