[[!toc]] # Scenario I have got a 250GB SATA harddisk with DragonFlyBSD 2.3.2 32-bit installed on it. Actually I want to repartition my harddisk in order to install other OSes besides DragonFly, so for that I need to shrink the current installation size. Above all, I would like my system just like it is now. Although several methods could be used, as this is a HAMMER installation, I'm going to use HAMMERS's mirror-{read,write} capabilities. This assumes you cannot store the PFSs in another HAMMER disk so that you have to store physical data compressed in files that can be put in any share you have. Here I will be using a NFS share. # Pre-steps ## HAMMER version You should check that your HAMMER version is at least 2 (NORM 2.3 - New directory entry layout). smash64# hammer version / min=1 wip=3 max=2 current=2 description="2.3 - New directory entry layout" available versions: 1 NORM 2.0 - First HAMMER release 2 NORM 2.3 - New directory entry layout If not, you would have to use hammer version-upgrade. See [hammer(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=hammer§ion=8) for details. ## LiveCD You will need a DragonFlyBSD LiveCD in order to perform steps for the new installation. Release 2.4.0 or later is recommended. Download the ISOs from [here](http://www.dragonflybsd.org/mirrors/). # Data backup At this point you should have a place ready to store all the compressed files you are going to generate. In our case: smash64# df -h /mnt/pfs Filesystem Size Used Avail Capacity Mounted on dualsmash:/home/data/pfs 364G 235G 111G 68% /mnt/pfs smash64# So we can start saving all our data: smash64# cd /mnt/pfs smash64# hammer mirror-read / | gzip -3 -c > root.gz histogram range 0000000000000000 - 000000129a02c4b0 Mirror-read: Mirror from 0000000000000000 to 000000129a02c4b0 smash64# smash64# hammer mirror-read /var | gzip -3 -c > var.gz histogram range 0000000000000001 - 000000129a02c4f0 Mirror-read: Mirror from 0000000000000001 to 000000129a02c4f0 Mirror-read /var succeeded smash64# smash64# hammer mirror-read /tmp | gzip -3 -c > tmp.gz histogram range 0000000000000001 - 000000129a02c790 Mirror-read: Mirror from 0000000000000001 to 000000129a02c790 Mirror-read /tmp succeeded smash64# .... Make sure the shared storage you have used is available for the LiveCD. # New installation process ## Booting LiveCD Boot the LiveCD in the machine you want to install. You can run installer in order to do some basic configurations for the LiveCD environment, under option "LiveCD utilities", and then exit again to the shell. ## Backup data accesibility Prepare the share where you have the backup data: # mkdir /root/pfs # mount 192.168.3.1:/home/data/pfs /root/pfs # df -h /root/pfs Filesystem Size Used Avail Capacity Mounted on 192.168.3.1:/home/data/pfs 364G 247G 98G 72% /root/pfs ## Partition the disk This part is critical. With this you will lose all the data on the disk you have chosen. **Warning: You are discouraged to use fdisk. Use another partition utility while you can ** Initalize the disk and partition it. After that, you will have to manually # fdisk -BI ad4 # fdisk -i # Restoring the data # Fixing the configuration # Booting