-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 3/20/2012 5:25 AM, Markus Falb wrote:
On 19.3.2012 10:14, Peter Kjellström wrote:
On Sunday 18 March 2012 19.40.21 Ray Van Dolson wrote:
On Sun, Mar 18, 2012 at 08:04:14PM +0100, Markus Falb wrote:
What filesystem? Assuming ext3, this cannot shrunk without unmounting. I believe the following *should* work for ext3
$ umount /home $ e2fsck -f /dev/vg_web/lv_home $ resize2fs /dev/vg_web/lv_home 150g $ lvresize -L 150g /dev/vg_web/lv_home $ mount /home
I am not sure how safe it is. Take care!
I'd like to add that it's probably good paranoia not to size the lv down too tightly (should it happen to become smaller than the fs then ooops). That is, I'd size the lv down to a comfortable margin above the fs size (and then size the fs up to the device size).
Hmm. I did that too a couple of times in the past. But why? What are the reasons for the paranoia?
I think he means don't resize/shrink the filesystem *and* the LVM LV to the exact same size. If the LVM lvresize command were to truncate the end of the existing filesystem, now you have issues.
Instead do this: first shrink the filesystem a little smaller than you want, then resize the LVM LV down to the desired size, then resize the filesystem again to grow to use the remaining space. This way you ensure you don't snip of the end of the filesystem.
# umount /home # e2fsck -f /dev/vg_web/lv_home # resize2fs /dev/vg_web/lv_home 149g # lvresize -L 150g /dev/vg_web/lv_home # resize2fs /dev/vg_web/lv_home (will default to the LV size of 150g) # mount /home
- -- David Goldsmith