Quantcast
Channel: How do I resize a logical volume to the size of the filesystem within it? - Server Fault
Viewing all articles
Browse latest Browse all 3

Answer by mr.zog for How do I resize a logical volume to the size of the filesystem within it?

$
0
0

It's not really a script per se.

rootvol=/dev/mapper/vg_stt-lv_root
mkdir /tmp/rootlv
mount -t ext4 -o ro $rootvol /tmp/rootlv
usedROOT=$(df -h $rootvol |  tail -1 | awk '{print $2}' | awk '{printf("%d\n",$1 + 1)}')
umount /tmp/rootvol
/sbin/lvresize --resizefs --size $usedROOT\g  $rootvol

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>