If you are *growing* the fs, you first need to increase the LV size with the lvol size option then increase the fs using filesystem resizefs option.
However, *shrinking* the fs opens up a can of worms... You'd have do it the opposite way around: first reduce the filesystem, then reduce the LV. But, looking at the code for *filesystem.py* it doesn't look like you can reduce the filesystem - it prints out the message saying it's doing it, but exits. It looks like it can *only* *grow* the filesystem, and only when it sees that the underlying device is larger. So, you'd need to run a command rather than using the filesystem module. Also, you'd need to make sure the shrink worked before resizing the underlying LV, otherwise you are asking for big trouble with your data ! To make things even more complicated, you can only shrink the filesystem if there is sufficient free space. Even then it might not work depending on how much meta data or fragmentation there is. The bottom line is that I'm not entirely sure how well suited CM tools (Ansible, Puppet, etc) are to filesystem management on an on-going basis. Possibly use CM for initial deployment or subsequent checking/reporting. But the idea of using CM tools to perhaps *shrink* a filesystem strikes me as very questionable in the first place. For example, not too long ago I dealt with a couple of systems that wouldn't boot because they both had a filesystem where fsck failed because the filesystem was larger than the underlying device. I'm quite sure the problem was caused by some buggy Puppet manifest code which had left a data corruption problem waiting to happen. On Thursday, 28 July 2016 17:49:59 UTC+1, Joanna Delaporte wrote: > > I was looking at the filesystem module today, hoping to use it to resize a > filesystem that is living in a logical volume. However, I am not sure how > to use it safely so it doesn't create a filesystem. Has anyone used the > filesystem module to resize an LV? If so, how did you do it? > > Thanks! > Joanna > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/40c04131-ae54-4769-bd2d-d578687ac673%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
