In order to shrink a partition, you need to take in consideration that the filesystem resides on the logical volume. So, firstly you have to shrink the filesystem and after that to shrink the logical Volume. If you do it in reverse, you will probably (for sure) loose your data.
So, clearing that up, here it goes:
Firstly we have to unmount the partition we need to shrink:
core:pool# df -h . Filesystem Size Used Avail Use% Mounted on /dev/mapper/datavg-MacPoolLv 410G 232G 179G 57% /home/vbox/.VirtualBox/osx/pool core:pool# [color=green]umount /home/vbox/.VirtualBox/osx/pool[/color]
Then, we shrink the filesystem with resize_reiserfs
command:
core:osx# resize_reiserfs -s350G /dev/mapper/datavg-MacPoolLv resize_reiserfs 3.6.19 (2003 www.namesys.com) You are running BETA version of reiserfs shrinker. This version is only for testing or VERY CAREFUL use. Backup of you data is recommended. Do you want to continue? [y/N]:y Processing the tree: 0%....20%....40%....60%....80%....100% left 0, 20052 /sec nodes processed (moved): int 357 (78), leaves 59861 (13895), unfm 60578370 (13712615), total 60638588 (13726588). check for used blocks in truncated region ReiserFS report: blocksize 4096 block count 91750400 (107479040) free blocks 31100802 (46828962) bitmap block count 2800 (3280) Syncing..done resize_reiserfs: Resizing finished successfully.
If everything goes well (and it should, it never failed to me), we shrink the logical volume:
core:osx# lvresize -L350G /dev/mapper/datavg-MacPoolLv WARNING: Reducing active logical volume to 350.00 GB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce MacPoolLv? [y/n]: y Reducing logical volume MacPoolLv to 350.00 GB Logical volume MacPoolLv successfully resized
Finally we mount the partition and see the results:
core:osx# mount -a core:osx# df -h /home/vbox/.VirtualBox/osx/pool Filesystem Size Used Avail Use% Mounted on /dev/mapper/datavg-MacPoolLv 350G 232G 119G 67% /home/vbox/.VirtualBox/osx/pool