Hey,
(Wir versuchen, Englisch als Forensprache zu etablieren, um internationale User einzubeziehen. Daher antworte ich in Englisch. Falls Sie kein Englisch sprechen, antworte ich auch gerne noch mal auf Deutsch.)
This is possible if the file system supports shrinking and the amount of allocated data is less than the new size for the logical volume. It requires starting the server from a rescue system (technically this isn’t true for all cases, but it makes it easier to explain). The steps are:
- Reboot from a rescue system such as grml
- Shrink the logical volume & the file system (you probably have to run a file system check before)
- Move all of the logical volume’s extents from the physical volumes you want to remove to the physical volumes you want to keep
- Remove the physical volumes from your volume group
- Enlarge the logical volume to cover any remaining space again
- Shutdown the server, remove the physical volume, start it normally
All of this is explained all over the internet in great detail. It’s not UCS specific. Any guide should do.
In short:
Shrinking the logical volume so that it’s definitely small enough so that you can remove the physical volume later. For example, if you have 2x 2TB physical volumes and you want to remove one, shrink the logical volume to e.g. 1.9TB: lvresize --size 1900G --resizefs name-of-your-volume-group/name-of-your-logical-volume
(pay attention to --size
! Without a -
or +
you’re giving the new total size, not the number size to add or remove!).
Moving the extents off the physical volume you want to remove, e.g. /dev/sdb1
, is easy: pvmove /dev/sdb1
Removing the physical volume from your volume group: vgreduce name-of-your-volume-group /dev/sdb1
Now your volume group covers the first physical volume and nothing more. You can re-enlarge your logical volume to cover everything from your volume group now: lvresize --extents +100%FREE --resizefs name-of-your-volume-group/name-of-your-logical-volume
Kind regards
mosu