1 *** THIS GUIDE IS INCOMPLETE ***
5 I have got a 250GB SATA harddisk with DragonFlyBSD 2.3.2 32-bit installed on it.
7 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.
9 Although several methods could be used, as this is a HAMMER installation, I'm going to use HAMMERS's mirror-{read,write} capabilities.
10 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.
11 Here I will be using a NFS share.
15 You should check that your HAMMER version is at least 2 (NORM 2.3 - New directory entry layout).
17 smash64# hammer version /
18 min=1 wip=3 max=2 current=2 description="2.3 - New directory entry layout"
20 1 NORM 2.0 - First HAMMER release
21 2 NORM 2.3 - New directory entry layout
23 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.
26 You will need a DragonFlyBSD LiveCD in order to perform steps for the new installation. Release 2.4.0 or later is recommended.
27 Download the ISOs from [here](http://www.dragonflybsd.org/mirrors/).
31 Note that if your /boot is out of the ROOT HAMMER filesystem, you should copy the data also, so you can restore your current kernel in the new installation. Having kernel and world out of sync can be a problem sometimes. You have been warned.
34 At this point you should have a place ready to store all the compressed files you are going to generate.
37 smash64# df -h /mnt/pfs
38 Filesystem Size Used Avail Capacity Mounted on
39 dualsmash:/home/data/pfs 364G 235G 111G 68% /mnt/pfs
42 So we can start saving all our data:
46 smash64# hammer mirror-read / | gzip -3 -c > root.gz
47 histogram range 0000000000000000 - 000000129a02c4b0
48 Mirror-read: Mirror from 0000000000000000 to 000000129a02c4b0
51 smash64# hammer mirror-read /var | gzip -3 -c > var.gz
52 histogram range 0000000000000001 - 000000129a02c4f0
53 Mirror-read: Mirror from 0000000000000001 to 000000129a02c4f0
54 Mirror-read /var succeeded
57 smash64# hammer mirror-read /tmp | gzip -3 -c > tmp.gz
58 histogram range 0000000000000001 - 000000129a02c790
59 Mirror-read: Mirror from 0000000000000001 to 000000129a02c790
60 Mirror-read /tmp succeeded
65 Make sure the shared storage you have used is available for the LiveCD.
67 # New installation process
71 Boot the LiveCD in the machine you want to install.
72 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.
74 ## Backup data accesibility
76 Prepare the share where you have the backup data:
78 # mount 192.168.3.1:/home/data/pfs /root/pfs
80 Filesystem Size Used Avail Capacity Mounted on
81 192.168.3.1:/home/data/pfs 364G 247G 98G 72% /root/pfs
83 ## Creating disk layout
84 This part is critical. With this you will lose all the data on the disk you have chosen.
86 **Warning: You are discouraged to use fdisk. Use another partition utility while you can **
88 Initalize the disk and partition it. After that, you will have to manually partition your disk, and with fdisk can be no fun.
93 ( this is only an extract )
97 Do you want to change our idea of what BIOS thinks ? [n]
98 Media sector size is 512
99 Warning: BIOS sector numbering starts with sector 1
100 Information from DOS bootblock is:
101 The data for partition 1 is:
102 sysid 165,(DragonFly/FreeBSD/NetBSD/386BSD)
103 start 63, size 148990401 (72749 Meg), flag 0
104 beg: cyl 0/ head 1/ sector 1;
105 end: cyl 1023/ head 255/ sector 63
106 Do you want to change it? [n] y
107 Supply a decimal value for "sysid (165=DragonFly)" [0] 165
108 Supply a decimal value for "start" [0] 63
109 Supply a decimal value for "size" [0] 148990401
110 Explicitly specify beg/end address ? [n]
111 Warning: ending cylinder wraps, using all 1's
112 sysid 165,(DragonFly/FreeBSD/NetBSD/386BSD)
113 start 63, size 148990401 (72749 Meg), flag 0
114 beg: cyl 0/ head 1/ sector 1;
115 end: cyl 1023/ head 255/ sector 63
116 Are we happy with this entry? [n] y
117 Do you want to change the active partition? [n] y
118 Supply a decimal value for "active partition" [1] 1
119 Are you happy with this choice [n] y
123 Information from DOS bootblock is:
124 1: sysid 165,(DragonFly/FreeBSD/NetBSD/386BSD)
125 start 63, size 148990401 (72749 Meg), flag 80 (active)
126 beg: cyl 0/ head 1/ sector 1;
127 end: cyl 1023/ head 255/ sector 63
131 Should we write new partition table? [n] y
133 Now that we have the partition, we can create the slices for our new installation.
135 As of now, the recommended configuration is ***/boot*** on UFS and ***/*** can be HAMMER.
138 # disklabel64 -r -w ad4s1 auto
139 # disklabel64 -e ad4s1
141 (do the layout you want)
144 # size offset fstype fsuuid
145 a: 262144 0 4.2BSD # 256.000MB
146 b: 1048576 262144 swap # 1024.000MB
147 d: 73184440 1310720 HAMMER # 71469.180MB
149 Finally, we create the filesystems:
152 /dev/ad4s1a: media size 256.00MB
153 Warning: Block size restricts cylinders per group to 94.
154 /dev/ad4s1a: 524288 sectors in 128 cylinders of 1 tracks, 4096 sectors
155 256.0MB in 2 cyl groups (94 c/g, 188.00MB/g, 16256 i/g)
156 super-block backups (for fsck -b #) at:
159 # newfs_hammer -L ROOT /dev/ad4s1d
160 Volume 0 DEVICE /dev/ad4s1d size 69.79GB
161 initialize freemap volume 0
162 ---------------------------------------------
163 1 volume total size 69.79GB version 2
164 boot-area-size: 64.00MB
165 memory-log-size: 256.00MB
166 undo-buffer-size: 104.00MB
167 total-pre-allocated: 120.00MB
168 fsid: 738615f8-a702-11de-8ec9-011617eff231
172 ## Prepare mount points
174 Now we setup the mount points where the data will actually be restored.
179 # mount_hammer /dev/ad4s1d /root/target
180 # mkdir /root/target/boot
181 # mkdir /root/target/pfs
182 # mount /dev/ad4s1a /root/target/boot
184 You must create an intermediate slave PFS in order to restore / mount. PFS#0 cannot be downgraded to slave, so you have no choice here.
185 We create all the PFSs as slaves, and mount_null them.
187 # hammer pfs-slave /root/target/var
189 # hammer pfs-slave /root/target/usr
191 # hammer pfs-slave /root/target/tmp
193 # hammer pfs-slave /root/target/home
195 # cd /root/target && mv var usr tmp home pfs
196 # mkdir var usr tmp home
198 # hammer pfs-slave /root/target/var/tmp
200 # hammer pfs-slave /root/target/var/crash
202 # hammer pfs-slave /root/target/usr/obj
204 # hammer pfs-slave /root/target/rootcopy
205 Creating PFS #1 succeeded!
206 /root/target/rootcopy
214 # Fixing the configuration