(no commit message)
[ikiwiki.git] / docs / handbook / Installation / index.mdwn
1 This document describes the installation of DragonFly BSD. This process uses a bootable DragonFly CD or USB disk image, usually referred to as a 'live CD' or 'USB disk image'.  These are available at one of the current mirrors, which distribute the images by various protocols.
2
3 It is recommended to install DragonFly with USB because USB is faster and more flexible.
4
5
6 [[!toc  levels=3]]
7
8
9 ----
10
11
12 # Installation from CD or USB
13
14
15 ## Downloading DragonFly BSD
16
17 Choose the closest [mirror](/mirrors/) site and go to `iso-images/` directory. Then choose installation image:
18
19 [[!table  data="""
20 |<tablestyle="width:100%"> |
21  **dfly-x86_64-X.X.X_REL.iso** | uncompressed image for CD and VM.
22  **dfly-x86_64-X.X.X_REL.iso.bz2** | compressed image for CD and VM.
23  **dfly-x86_64-X.X.X_REL.img.bz2** | compressed image for USB.
24 """]]
25
26 Then download `md5.txt` and verify image:
27
28     % md5 -C md5.txt dfly-x86_64-X.X.X_REL.*
29     (MD5) dfly-x86_64-X.X.X_REL.img.bz2: OK
30     (MD5) dfly-x86_64-X.X.X_REL.iso: OK
31     (MD5) dfly-x86_64-X.X.X_REL.iso.bz2: OK
32
33
34
35 ## Creating install media
36
37 Decompress downloaded image if it is compressed:
38
39     % bzip2 -d dfly-x86_64-X.X.X_REL.iso.bz2
40
41
42 ### Flash drives
43
44 A bootable USB flash drive can be created by attaching the target device and copying over the image with [dd(1)](https://leaf.dragonflybsd.org/cgi/web-man?command=dd&section=1).
45
46 Using DragonFly BSD, assuming device was recognized as sd8:
47
48     # dd if=dfly-x86_64-*_REL.img of=/dev/sd8 bs=1m
49
50
51 ### CD
52
53 DragonFly's image is too big to fit on CD-ROM, however, it fits on DVD.
54
55 You can create a bootable CD on DragonFly BSD by using [cdrecord(1)](https://leaf.dragonflybsd.org/cgi/web-man?command=cdrecord&section=1)
56
57     # cdrecord -tao dfly-x86_64-*_REL.iso
58
59
60
61 ## Performing a simple install
62
63 The installer is designed to install DragonFly BSD with a minimum of user intervention.  In fact, you can often just hit [Enter] to get a good DragonFly BSD install, moving your hands to the rest of the keyboard only to make choises.
64
65 After [dmesg(8)](https://leaf.dragonflybsd.org/cgi/web-man?command=dmesg&section=8) is shown, you will see the first installer question:
66
67     ...
68     Welcome to DragonFly!
69
70     To start the installer, login as 'installer'. To just get a shell prompt, login as 'root'
71
72     DragonFly/x86_64 (Amnesiac) (ttyv0)
73
74     login: 
75
76 Type `installer` and press [Enter] and follow the instructions.
77
78
79 # Manual Installation (all types) (assumes whole disk)
80
81 WARNING! These instructions assume that 'da0' is the drive you are installing to and that you booted from somewhere else.  'da0' in these instructions must not contain anything you used to boot the system from.  Normally you will have booted from some other media, such as a USB stick, CD, or the network.  
82
83 WARNING! These instructions assume that you are not sharing the drive with any other operating system and have no data on the drive that you wish to keep.  Generally speaking, my recommendation is to not have multi-OS boot setups (its too easy to mistakenly wipe them when messing around with other installations).  Instead, invest in a hot-swap drive bay and put each OS on its own SSD.
84
85 To do a manual installation you need to initialize the disk.  DragonFlyBSD uses a modified fdisk which works on any-sized disk by having the kernel recognize the maximum size fdisk supports and translate that to the whole disk's actual size.  You need to install the boot sector and also setup a bootable DragonFlyBSD disklabel.
86
87     # fdisk -IB /dev/da0
88
89     # disklabel -r -w -B /dev/da0s1 auto
90
91 Edit the label and create three partitions: a, b, and d.  The 'a' partition is going to be /boot and needs to be a 1GB UFS partition.  'b' is your swap and should be roughly 2x main memory (we recommend at least 4GB or more, particularly if you will be running browsers).  'd' is your root partition.
92
93     # disklabel -e da0s1
94
95     a: 1G 0 4.2BSD
96     b: 8G * swap
97     d: * * HAMMER
98
99 One can simply use HAMMER2 instead of HAMMER on the d: line if the HAMMER2 filesystem is going to be used.
100
101
102 # Manual Non-Crypto Installation
103
104 Format the filesystems and mount them:
105
106     # newfs /dev/da0s1a
107     # newfs_hammer -L ROOT /dev/da0s1d # Use newfs_hammer2 for HAMMER2
108     # mount /dev/da0s1d /mnt
109     # mkdir /mnt/boot
110     # mount /dev/da0s1a /mnt/boot
111
112 Once you have them mounted, copy from a working DragonFly installation.  This can be from installation media or via NFS if you have setup the network and have a server somewhere.  Two cpdup commands are needed since we have two partitions.  If the source of your image is broken up into additional partitions, you may have to cpdup each one (cpdup nominally stops at mount boundaries on the source):
113
114     # cpdup /boot /mnt/boot
115     # cpdup / /mnt
116
117 Finally, edit "/mnt/boot/loader.conf", "/mnt/etc/fstab", and "/mnt/etc/rc.conf" to point to your disk.  At a minimum you will need this line in your "/mnt/boot/loader.conf" (we recommend configuring by serial number, which you can get from the dmesg output, but if you don't want to then use the drive name which might be something like 'da0s1d'):
118
119     vfs.root.mountfrom="hammer:serno/SERIALNUMOFDISK.s1d" # Use vfs.root.mountfrom="hammer2:serno/SERIALNUMOFDISK.s1d" for HAMMER2
120
121 Your "/etc/fstab" file should contain something like the below:
122
123     serno/SERIALNUMOFDISK.s1a    /boot           ufs     rw              1 1
124     serno/SERIALNUMOFDISK.s1b    none            swap    sw              0 0
125     serno/SERIALNUMOFDISK.s1d    /               hammer  rw              1 1
126     #following line for HAMMER2
127     #serno/SERIALNUMOFDISK.s1d    /               hammer2  rw              1 1
128
129 Finally, unmount the partitions and reboot the machine.  Once the machine is in reset, before it hits the BIOS, unplug your installation media:
130
131     # umount /mnt/boot
132     # umount /mnt
133     # reboot
134
135
136
137 # Manual Crypto Installation
138
139 To setup a crypto system follow the generic non-crypto steps above.  Make sure that your boot drive has a "/boot/kernel/initrd.img.gz" file in as the system will need to bootstrap through MD0 in order to mount an encrypted root.  In this example I am also encrypting swap.
140
141 If your drive partitions previously contained unencrypted data and you want to wipe it, you can dd /dev/urandom to the target partitions.  It can take many hours to do this so you might decide to skip this optional step:
142
143     # dd if=/dev/urandom of=/dev/da0s1b bs=32k
144     # dd if=/dev/urandom of=/dev/da0s1d bs=32k
145
146 Setup an encrypted swap and root partition as shown below (be careful of the password you type as the keyboard will be in qwerty when you decrypt, that can be changed by modifying the initrd later):
147
148     # kldload dm
149     # cryptsetup --key-size 256 --hash sha512 -y luksFormat /dev/da0s1b
150     # cryptsetup --key-size 256 --hash sha512 -y luksFormat /dev/da0s1d
151     # cryptsetup luksOpen /dev/da0s1b swap
152     # cryptsetup luksOpen /dev/da0s1d root # Use rootd instead of root for HAMMER2
153
154 Format the filesystems and mount them.  Note that the boot partition is not encrypted.
155
156     # newfs /dev/da0s1a
157     # newfs_hammer -L ROOT /dev/mapper/root # newfs_hammer2 /dev/mapper/rootd for HAMMER2
158     # mount /dev/mapper/root /mnt           # mount_hammer2 /dev/mapper/rootd /mnt for HAMMER2
159     # mkdir /mnt/boot
160     # mount /dev/da0s1a /mnt/boot
161
162 Once you have them mounted, copy from a working DragonFly installation.  This can be from installation media or via NFS if you have setup the network and have a server somewhere.  Two cpdup commands are needed since we have two partitions.  If the source of your image is broken up into additional partitions, you may have to cpdup each one (cpdup nominally stops at mount boundaries on the source):
163
164     # cpdup /boot /mnt/boot
165     # cpdup / /mnt
166
167 Finally, edit "/mnt/boot/loader.conf", "/mnt/etc/fstab", and "/mnt/etc/rc.conf" to point to your disk.  At a minimum you will need this line in your "/mnt/boot/loader.conf" (we recommend configuring by serial number, which you can get from the dmesg output, but if you don't want to then use the drive name which might be something like 'da0s1d').
168
169     initrd.img_load="YES"
170     initrd.img_type="md_image"
171     vfs.root.mountfrom="ufs:md0s0"
172     vfs.root.realroot="crypt:hammer:serno/SERIALNUMOFDISK.s1d:root" # vfs.root.realroot="crypt:hammer2:serno/SERIALNUMOFDISK.s1d:rootd" for HAMMER2
173     dm_load="YES"
174     dm_target_crypt_load="YES"
175
176 You can note that we are using rootd in the case of HAMMER2, that's because it's not possible to pass a HAMMER2 label to the rcmount_crypt script in the initrd, and so the mapping name has to end in d so that mount_hammer2 will automatically use the ROOT label for mounting
177
178 Your "/etc/fstab" file should contain something like the below:
179
180     serno/SERIALNUMOFDISK.s1a    /boot           ufs     rw              1 1
181     /dev/mapper/root              /               hammer  rw              1 1
182     #following line for HAMMER2
183     #/dev/mapper/rootd              /               hammer2  rw              1 1
184
185 You can setup the encrypted swap via the "/etc/rc.local" file with the following lines:
186
187     # cryptsetup luksOpen /dev/serno/SERIALNUMOFDISK.s1b swap
188     #swapon /dev/mapper/swap
189
190 Finally, unmount the partitions and reboot the machine.  Once the machine is in reset, before it hits the BIOS, unplug your installation media:
191
192     # umount /mnt/boot
193     # umount /mnt
194     # reboot
195
196
197 # Installation to a Disk Slice in a Multiboot Set-up with rEFInd
198
199 Currently, the DragonFly BSD Installer only supports a full-disk installation. Obviously, this
200 set-up is not appropriate for multibooting with other operating systems (OSs), because each OS
201 resides on its own hard drive slice. Therefore, for multiboot you have to install DragonFly to a hard
202 drive slice. For this, you have to do a manual installation. 
203
204 Assuming a machine with Unified Extensible Firmware Interface (UEFI), we will use 
205 [rEFInd](http://www.rodsbooks.com/refind) as boot manager. Prior to starting the DragonFly installation,
206 please download the latest rEFInd version as a [binary zip file](http://www.rodsbooks.com/refind/getting.html),
207 unzip it and write it to a USB stick.
208
209 After booting DragonFly with the install medium, login as root. To see how your hard drive is
210 recognised, issue:
211
212         # camcontrol devlist
213
214 to list your IDE/SCSI devices
215
216 or, if you have a Solid State Drive (SSD),
217
218         # nvmectl info
219
220 An IDE/SCSI drive will be recognised as da0 and an SSD as nvme0. For simplicity, hereafter an nvme device is
221 assumed. If you have an IDE/SCSI drive, you can simply substitute nvme0 with da0 in the following
222 instructions.
223
224 ## Partition the hard drive
225
226 To be safe, first clean up the starting sectors of the disk drive from remnants of any previous
227 partitioning:
228
229         # dd if=/dev/zero of=/dev/nvme0 count=1024 bs=1m
230
231 Here, we assume GUID Partition Table (GPT) partitioning (see the gpt manual page).
232
233 Destroy any existing GPT partition table:
234
235         # gpt destroy nvme0
236
237 Create a new partition table:
238
239         # gpt create -f nvme0
240
241 In between, to view the current partition table, you can issue:
242
243         # gpt -v show -l nvme0
244
245 Before you start adding the slices, note that slice sizes are specified in number of disk drive
246 sectors. Normally, a sector has 512 bytes. To check that, you can run:
247
248         # dmesg | grep blksize
249
250 The output will look something like this:
251
252 nvme0: Disk nvme0 ns=1 blksize=512 lbacnt=1000215216 cap=476GB serno=S33UNB0J606162-1
253
254 in which case it confirms that the sector size is 512 bytes. So, if you need a slice of size S bytes,
255 you have to specify S/512 number of sectors for it. 
256
257 First, you have to create the EFI system partition (ESP) of 512 MiB. The ESP will be your first
258 slice and hence it will get a slice number of 0. The corresponding number of sectors is 
259 (512 * 1024 ** 2) / 512 = 1048576:
260
261         # gpt add -i 0 -s 1048576 -t efi nvme0
262
263 In the above command, -i specifies slice number 0, -s the slice size in sectors, and -t specifies the
264 slice type.
265
266 Give the EFI slice a UTF-8 label:
267
268         # gpt label -i 0 -l "EFI System" nvme0
269
270 Create the DragonFly slice of, say 200 GiB:
271
272         # gpt -v show nvme0 gpt add -i 1 -s 419430400 -t dfly nvme0
273
274 Label the DragonFly slice:
275
276         # gpt label -i 1 -l "DragonFly BSD" nvme0
277
278 Now you can create your disklabel partitions on the DragonFly slice. Normally, you want a disk
279 layout consisting of an "a" partition for /boot, a "b" partition for swap and a "d" partition for
280 the root file system.
281
282 Create a standard virgin disk label for the DragonFly slice:
283         # disklabel64 -r -w nvme0s1 auto
284
285 Create the disklabel partitions on the DragonFly slice:
286
287         # disklabel64 -e nvme0s1
288
289 The above command opens a text editor, where you can describe the partitions you want to add, with their
290 sizes and file system types. For the above layout, you can add the following three lines:
291
292         a: 1G * 4.2BSD
293         b: 16G * swap
294         d: * * HAMMER2
295
296 to specify a partition "a" of 1 GiB that will carry a UFS file system, a partition "b" of 16 GiB for
297 swap, and a partition "d" encompassing the remaining space on the DragonFly slice for the root file
298 system. The [size of the swap space](https://itsfoss.com/swap-size) depends on the available RAM.
299
300 Now you can proceed adding slices for the rest of the OSs you plan to install. E.g., to add a 200
301 GiB OpenBSD slice:
302
303         # gpt add -i 2 -s  419430400 -t "Unused" nvme0
304
305 Specifying -t "OpenBSD" in the above command is not supported. You will have to modify that partition type later when installing OpenBSD.
306
307 Label the OpenBSD slice:
308
309         # gpt label -i 2 -l "OpenBSD" nvme0
310
311 To add a linux slice encompassing the remaining space on the disk drive:
312
313         # gpt add -i 3 -t linux nvme0
314
315 Label the linux slice:
316
317         # gpt label -i 3 -l "Linux"
318
319 ## Install rEFInd to the ESP
320
321
322 Format the ESP slice with FAT file system:
323
324         # newfs_msdos nvme0s0
325
326 Create a mount point for the ESP:
327
328         # mkdir /efimnt
329
330 Mount the ESP:
331
332         # mount_msdos /dev/nvme0s0 /efimnt
333
334 Create the required directory structure of the ESP:
335
336         # mkdir -p /efimnt/EFI/BOOT
337
338 Install rEFInd to the ESP:
339
340 Create a mount point for the USB stick with the rEFInd executables:
341
342         # mkdir /usb
343
344 Go to the EFI/BOOT directory of the ESP:
345
346         # cd /efimnt/EFI/BOOT
347
348 Insert the USB stick with the rEFInd executables. On inserting the stick, the system reports the new
349 device. You can double-check how it is recognised by issuing:
350
351         # camcontrol devlist
352
353 Assuming the USB stick is recognised as /dev/da9, mount the USB stick with the rEFInd executables: 
354
355         # mount_msdos /dev/da9s1 /usb
356
357 Copy the rEFInd executables to the current directory (assuming you have rEFInd version x.y.z):
358
359         # cp -r /usb/refind-bin-x.y.z/refind/* .
360
361 Unmount the USB stick with the rEFInd executables and delete its mount point:
362
363         # umount /usb
364         # rmdir /usb
365
366 Remove the unnecessary drivers, efi executables and tools. E.g, for an amd64 machine you have to
367 remove the *aa64* and *ia32* files and directories:
368
369         # rm -rf *aa64* *ia32* 
370
371 Rename the rEFInd executable:
372
373         # mv refind_x64.efi bootx64.efi
374
375 Copy the DragonFly BSD boot1.efi under a different name:
376
377         # cp /boot/boot1.efi bootx64-dragonflybsd.efi
378
379 Rename the rEFInd configuration file:
380
381         # mv refind.conf-sample refind.conf
382
383 Edit refind.conf:
384
385         # vi refind.conf 
386
387 Add this section:
388
389      menuentry "DragonFly BSD" {
390            loader /EFI/BOOT/bootx64-dragonflybsd.efi
391            icon /EFI/BOOT/icons/os_freebsd.png
392      }
393
394 You may ask why the freebsd icon is provided above? Well, currently there is no os_dragonflybsd.png
395 icon. If you wish, you can create your own one and copy it to the ./icons directory; it has to be a
396 128 x 128 png. Of course, as you install other OSs at a later stage, you have to provide relevant
397 entries for them in the refind.conf file and copy the necessary booting executables to the ESP.
398 Information on this is usually provided by the OS or available as part of the rEFInd documentation.
399 Caveat: when installing the other OSs, make sure their installers do not overwrite the ESP you just
400 created. It would be best to not install rEFInd for the other OS using the OS's installer, but do
401 this manually: the process involves copying a few relevant files to the ESP and making a respective
402 entry in refind.conf.
403
404 Leave the ESP: 
405
406         # cd
407
408 Unmount the ESP:
409
410         # umount /efimnt
411
412 Delete the ESP's mount point:
413
414         # rmdir /efimnt
415
416 Now you can proceed creating the DragonFly disklabel partitions, formatting them with the
417 filesystems of your choice, and installing DragonFly as described above in the section on Manual
418 Non-Crypto Installation. When you reboot, you should see the rEFInd screen prompting you to select
419 which OS to boot.
420
421
422 # Manual Installation with an Extended HAMMER2 Disk Layout
423
424 [HAMMER](https://leaf.dragonflybsd.org/cgi/web-man?command=hammer&section=ANY) is a file system
425 that allows creating pseudo file systems (PFSs) within it, which dynamically share a common storage
426 space. Oversimplified, you can think of HAMMER as of a logical volume manager (LVM) with logical
427 volumes (PFSs) that are not of fixed size. Each PFS obtains as much space from the HAMMER file
428 system as it needs. Here, we consider the
429 [HAMMER2](https://leaf.dragonflybsd.org/cgi/web-man?command=hammer2&section=ANY) file system, which
430 is the follower of HAMMER. 
431
432 This section shows how to create the following disk layout:
433
434         # mount -p
435         nvme0s1d                /               hammer2 rw                      1 1
436         devfs                   /dev            devfs   rw,nosymfollow          0 0
437         /dev/nvme0s1a           /boot           ufs     rw                      1 1
438         @usr                    /usr            hammer2 rw                      0 0
439         @usr.dports             /usr/dports     hammer2 rw                      0 0
440         @usr.local              /usr/local      hammer2 rw                      0 0
441         @usr.src                /usr/src        hammer2 rw                      0 0
442         @var                    /var            hammer2 rw                      0 0
443         @home                   /home           hammer2 rw,nosuid               0 0
444         @build                  /build          hammer2 rw                      0 0
445         /build/usr.distfiles    /usr/distfiles  null    rw                      0 0
446         /build/usr.obj          /usr/obj        null    rw                      0 0
447         /build/var.cache        /var/cache      null    rw                      0 0
448         /build/var.crash        /var/crash      null    rw                      0 0
449         /build/var.log          /var/log        null    rw                      0 0
450         /build/var.run          /var/run        null    rw                      0 0
451         /build/var.spool        /var/spool      null    rw                      0 0
452         tmpfs                   /tmp            tmpfs   rw,noexec,nosuid,nodev  0 0
453         tmpfs                   /var/tmp        tmpfs   rw,noexec,nosuid,nodev  0 0
454         tmpfs                   /var/run/shm    tmpfs   rw                      0 0
455         tmpfs               /var/run/user/1001  tmpfs   rw                      0 0
456         procfs                  /proc           procfs  rw                      0 0
457
458 This layout is relatively complicated, as it uses separate PFSs for directories that are separately
459 mounted in many UNIX installations. Furthermore, file systems that do need backup are mounted under
460 the /build PFS, which is something like scratch space in DragonFly. /tmp and /var/tmp are
461 implemented as tmpfs.
462
463 In the following, it is assumed you have already booted the install medium, logged in as root,
464 sliced the hard drive and created your disklabel partitions "a" for /boot, formatted with UFS, "b"
465 for swap, and "d" for /, formatted with HAMMER2. It is furthermore assumed your disk drive is
466 recognised as nvme0.  If your drive is recognised as something else, e.g. da0, you can simply
467 replace nvme0 with da0 in the following commands.
468
469 Note:
470 When creating mount points and mounting disk partitions it is important to keep in mind that the
471 directory hierarchy determines the order of the commands. More specifically, if partition B is to be
472 mounted under a directory of partition A, then first partition A has to be mounted, then the mount
473 point for partition B created on A, and finally partition B mounted. If you proceed first creating the
474 mount points and then mounting the partitions without heeding the hierarchy you will get into
475 trouble :-). Be warned about that.
476
477 So, let's create the layout.
478
479 Mount the disklabel partitions (the swap partition is not mounted): 
480
481         # mount_hammer2 nvme0s1d /mnt
482         # mkdir /mnt/boot
483         # mount nvme0s1a /mnt/boot
484
485 Note that first the / partition is mounted, then the mount point for /boot is created on the mounted
486 /, and finally the /boot partition is mounted. This sequence of commands is determined by the file
487 system hierarchy as discussed in the note above.  
488
489 Create the HAMMER2 PFSs. The path to the mounted HAMMER2 ROOT file system is specified via the -s
490 parameter:
491
492         # hammer2 -s /mnt pfs-create usr
493         # hammer2 -s /mnt pfs-create usr.dports
494         # hammer2 -s /mnt pfs-create usr.local
495         # hammer2 -s /mnt pfs-create usr.src
496         # hammer2 -s /mnt pfs-create var
497         # hammer2 -s /mnt pfs-create home
498         # hammer2 -s /mnt pfs-create build
499
500 To view the created PFSs, you can in between issue:
501
502         # hammer2 pfs-list /mnt
503
504 Create the mount points and mount the PFSs, taking care of the directory hierarchy (see the note
505 above on creating mount points and mounting partitions):
506
507         # mkdir /mnt/usr
508         # mount_hammer2 @usr /mnt/usr # note how a PFS is specified by a "@" in front
509
510         # mkdir /mnt/usr/dports
511         # mkdir /mnt/usr/local
512         # mkdir /mnt/usr/src
513         # mkdir /mnt/var
514         # mkdir /mnt/build
515          
516         # mount_hammer2 @usr.dports /mnt/usr/dports
517         # mount_hammer2 @usr.local /mnt/usr/local
518         # mount_hammer2 @usr.src /mnt/usr/src
519         # mount_hammer2 @var /mnt/var
520         # mount_hammer2 @build /mnt/build
521
522 Note that among these directories there are such with non-existent (/usr/dports and /usr/src) or
523 empty (/build and /home) counterparts on the install medium. You may ask why /usr/dports
524 and /usr/src are mounted although they will remain empty; the answer is, as cpdup does not cross mount
525 boundaries, this prevents cpdup from asking whether to delete them (because they do not exist on the
526 installation media) when copying /usr from the install medium at a later stage. There is no need to
527 mount /home, as it is an independent file system that will remain empty. On /build, we create
528 directories for file systems that do not normally need backup. At a later stage, we will null-mount
529 these directories to their respective mount points in the hierarchy.
530
531 Create directories for file systems that do not normally need backup:
532
533         # mkdir /mnt/build/usr.distfiles
534         # mkdir /mnt/build/usr.obj
535         # mkdir /mnt/build/var.cache
536         # mkdir /mnt/build/var.crash
537         # mkdir /mnt/build/var.log
538         # mkdir /mnt/build/var.run
539         # mkdir /mnt/build/var.spool
540
541 Create the mount points for the /build null mounts that do not exist on the install medium:
542
543         # mkdir /mnt/usr/distfiles
544
545 Create mount points for the non-empty /build null mounts:
546
547         # mkdir /mnt/var/crash
548         # mkdir /mnt/var/log
549         # mkdir /mnt/var/run
550         # mkdir /mnt/var/spool
551
552 There is no need to create mount points for the empty /build null mounts that exist on the install
553 medium (/usr/obj and /var/cache), as they will be copied by cpdup together with /usr and /var at a
554 later stage. 
555
556 Mount the non-empty /build null mounts:
557
558         # mount_null /mnt/build/var.crash /mnt/var/crash
559         # mount_null /mnt/build/var.log /mnt/var/log
560         # mount_null /mnt/build/var.run /mnt/var/run
561         # mount_null /mnt/build/var.spool /mnt/var/spool
562
563 Mount /usr/distfiles as it does not exist under /usr on the installation media (to prevent cpdup
564 from asking whether to delete it when copying /usr at a later stage):
565
566         # mount_null /build/usr.distfiles /mnt/usr/distfiles
567
568 Install DragonFly by copying the non-empty file systems. Luckily, cpdup won't cross mount boundaries
569 on the source or destination, so it takes a few commands:
570
571         # cpdup / /mnt
572         # cpdup /boot /mnt/boot
573         # cpdup /usr /mnt/usr
574         # cpdup /usr/local /mnt/usr/local
575         # cpdup /var /mnt/var
576
577 Copy the non-empty /build null mounts:
578
579         # cpdup /var/crash /mnt/var/crash
580         # cpdup /var/log /mnt/var/log
581         # cpdup /var/run /mnt/var/run
582         # cpdup /var/spool /mnt/var/spool
583
584 DragonFly BSD uses a different /etc from the one present on the install medium. The /etc on the
585 install medium is only used during installation. It is the /etc.hdd directory that is intended
586 for permanent use. You can delete /etc, but it is preferable to store it under the name /etc.live
587 instead:
588
589         # mv /mnt/etc /mnt/etc.live
590         # mv /mnt/etc.hdd /mnt/etc
591
592 There is no example fstab in /etc.hdd. The one from /etc.live has to be copied:
593
594         # cp /mnt/etc.live/fstab.example /mnt/etc/fstab
595
596 Describe all mounts in fstab:
597
598         # vi /mnt/etc/fstab
599
600 Enter the following content:
601
602         /dev/nvme0s1a /boot ufs rw 1 1
603         /dev/nvme0s1b none swap sw 0 0
604         /dev/nvme0s1d / hammer2 rw 1 1
605         @usr /usr hammer2 rw 0 0
606         @usr.dports /usr/dports hammer2 rw 0 0
607         @usr.local /usr/local hammer2 rw 0 0
608         @usr.src /usr/src hammer2 rw 0 0
609         @var /var hammer2 rw 0 0
610         @home /home hammer2 rw,nosuid 0 0 @build
611         /build hammer2 rw 0 0
612         /build/usr.distfiles /usr/distfiles null rw 0 0
613         /build/usr.obj /usr/obj null rw 0 0
614         /build/var.cache /var/cache null rw 0 0
615         /build/var.crash /var/crash null rw 0 0
616         /build/var.log /var/log null rw 0 0
617         /build/var.run /var/run null rw 0 0
618         /build/var.spool /var/spool null rw 0 0
619         tmpfs /tmp tmpfs rw,nosuid,noexec,nodev 0 0
620         tmpfs /var/tmp tmpfs rw,nosuid,noexec,nodev 0 0
621         proc /proc procfs rw 0 0
622         
623 Now, specify the correct root file system:
624
625         # vi /mnt/boot/loader.conf
626
627 Add the following content:
628
629         vfs.root.mountfrom="hammer2:nvme0s1d"
630
631 Unmount mounted filesystems:
632
633         # umount /mnt/boot
634         # umount /mnt/usr/distfiles
635         # umount /mnt/usr/dports
636         # umount /mnt/usr/local
637         # umount /mnt/usr/src
638         # umount /mnt/var/crash
639         # umount /mnt/var/log
640         # umount /mnt/var/run
641         # umount /mnt/var/spool
642         # umount /mnt/usr
643         # umount /mnt/var
644         # umount /mnt/build
645         # umount /mnt
646
647 Halt to give you time to remove the install medium:
648
649         # halt
650
651 Wait for the system to halt, remove the installation medium after that, and finally press any key to
652 reboot.
653