(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 [rEFInd](http://www.rodsbooks.com/refind) is a powerful boot manager for machines with Unified
205 Extensible Firmware Interface (UEFI), which are prevalent today. 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 ad0/da0 (see [Disk Slices, Partitions and local UNIX file systems](https://www.dragonflybsd.org/docs/handbook/UnixBasics/#index9h2)) and a modern 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 ad0/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
284         # disklabel64 -r -w nvme0s1 auto
285
286 Create the disklabel partitions on the DragonFly slice:
287
288         # disklabel64 -e nvme0s1
289
290 The above command opens a text editor, where you can describe the partitions you want to add, with their
291 sizes and file system types. For the above layout, you can add the following three lines:
292
293         a: 1G * 4.2BSD
294         b: 16G * swap
295         d: * * HAMMER2
296
297 to specify a partition "a" of 1 GiB that will carry a UFS file system, a partition "b" of 16 GiB for
298 swap, and a partition "d" encompassing the remaining space on the DragonFly slice for the root file
299 system. The [size of the swap space](https://itsfoss.com/swap-size) depends on the available RAM.
300
301 Now you can proceed adding slices for the rest of the OSs you plan to install. E.g., to add a 200
302 GiB OpenBSD slice:
303
304         # gpt add -i 2 -s  419430400 -t "Unused" nvme0
305
306 Specifying -t "OpenBSD" in the above command is not supported. You will have to modify that partition type later when installing OpenBSD.
307
308 Label the OpenBSD slice:
309
310         # gpt label -i 2 -l "OpenBSD" nvme0
311
312 To add a linux slice encompassing the remaining space on the disk drive:
313
314         # gpt add -i 3 -t linux nvme0
315
316 Label the linux slice:
317
318         # gpt label -i 3 -l "Linux"
319
320 ## Install rEFInd to the ESP
321
322
323 Format the ESP slice with FAT file system:
324
325         # newfs_msdos nvme0s0
326
327 Create a mount point for the ESP:
328
329         # mkdir /efimnt
330
331 Mount the ESP:
332
333         # mount_msdos /dev/nvme0s0 /efimnt
334
335 Create the required directory structure of the ESP:
336
337         # mkdir -p /efimnt/EFI/BOOT
338
339 Create a mount point for the USB stick with the rEFInd executables:
340
341         # mkdir /usb
342
343 Go to the EFI/BOOT directory of the ESP:
344
345         # cd /efimnt/EFI/BOOT
346
347 Insert the USB stick with the rEFInd executables. On inserting the stick, the system reports the new
348 device. You can double-check how it is recognised by issuing:
349
350         # camcontrol devlist
351
352 Assuming the USB stick is recognised as /dev/da9, mount the USB stick with the rEFInd executables: 
353
354         # mount_msdos /dev/da9s1 /usb
355
356 Copy the rEFInd executables to the current directory (assuming you have rEFInd version x.y.z):
357
358         # cp -r /usb/refind-bin-x.y.z/refind/* .
359
360 Unmount the USB stick with the rEFInd executables and delete its mount point:
361
362         # umount /usb
363         # rmdir /usb
364
365 Remove the unnecessary drivers, efi executables and tools. E.g, for an amd64 machine you have to
366 remove the *aa64* and *ia32* files and directories:
367
368         # rm -rf *aa64* *ia32* 
369
370 Rename the rEFInd executable:
371
372         # mv refind_x64.efi bootx64.efi
373
374 Copy the DragonFly BSD boot1.efi under a different name:
375
376         # cp /boot/boot1.efi bootx64-dragonflybsd.efi
377
378 Rename the rEFInd configuration file:
379
380         # mv refind.conf-sample refind.conf
381
382 Edit refind.conf:
383
384         # vi refind.conf 
385
386 Add this section:
387
388      menuentry "DragonFly BSD" {
389            loader /EFI/BOOT/bootx64-dragonflybsd.efi
390            icon /EFI/BOOT/icons/os_freebsd.png
391      }
392
393 You may ask why the freebsd icon is provided above? Well, currently there is no os_dragonflybsd.png
394 icon. If you wish, you can create your own one and copy it to the ./icons directory; it has to be a
395 128 x 128 png. Of course, as you install other OSs at a later stage, you have to provide relevant
396 entries for them in the refind.conf file and copy the necessary booting executables to the ESP.
397 Information on this is usually provided by the OS or available as part of the rEFInd documentation.
398 Caveat: when installing the other OSs, make sure their installers do not overwrite the ESP you just
399 created. It would be best to not install rEFInd for the other OS using the OS's installer, but do
400 this manually: the process involves copying a few relevant files to the ESP and making a respective
401 entry in refind.conf. For example, with OpenBSD, after finishing the installation and before rebooting, 
402 copy the file /mnt/usr/mdec/BOOTX64.EFI to a USB stick; then boot into DragonFly, copy that
403 file to the ESP under EFI/BOOT, and rename it to bootx64-openbsd.efi; add a respective entry
404 in refind.conf, using again a different icon as an OpenBSD one is currently not available as well.
405 On your next reboot, the rEFInd menu should contain both DragonFly and OpenBSD as boot options.
406
407 Leave the ESP: 
408
409         # cd
410
411 Unmount the ESP:
412
413         # umount /efimnt
414
415 Delete the ESP's mount point:
416
417         # rmdir /efimnt
418
419 Now you can proceed formatting the DragonFly disklabel partitions with the filesystems of your choice
420 and installing DragonFly as described above in the section on Manual Non-Crypto Installation. When you
421 reboot, you should see the rEFInd menu prompting you to select an OS to boot.
422
423
424 # Manual Installation with an Extended HAMMER2 Disk Layout
425
426 [HAMMER](https://leaf.dragonflybsd.org/cgi/web-man?command=hammer&section=ANY) is a file system
427 that allows creating pseudo file systems (PFSs) within it, which dynamically share a common storage
428 space. Oversimplified, you can think of HAMMER as of a logical volume manager (LVM) with logical
429 volumes (PFSs) that are not of fixed size. Each PFS obtains as much space from the HAMMER file
430 system as it needs. Here, we consider the
431 [HAMMER2](https://leaf.dragonflybsd.org/cgi/web-man?command=hammer2&section=ANY) file system, which
432 is the follower of HAMMER. 
433
434 This section shows how to create the following disk layout:
435
436         # mount -p
437         nvme0s1d                /               hammer2 rw                      1 1
438         devfs                   /dev            devfs   rw,nosymfollow          0 0
439         /dev/nvme0s1a           /boot           ufs     rw                      1 1
440         @usr                    /usr            hammer2 rw                      0 0
441         @usr.dports             /usr/dports     hammer2 rw                      0 0
442         @usr.local              /usr/local      hammer2 rw                      0 0
443         @usr.src                /usr/src        hammer2 rw                      0 0
444         @var                    /var            hammer2 rw                      0 0
445         @home                   /home           hammer2 rw,nosuid               0 0
446         @build                  /build          hammer2 rw                      0 0
447         /build/usr.distfiles    /usr/distfiles  null    rw                      0 0
448         /build/usr.obj          /usr/obj        null    rw                      0 0
449         /build/var.cache        /var/cache      null    rw                      0 0
450         /build/var.crash        /var/crash      null    rw                      0 0
451         /build/var.log          /var/log        null    rw                      0 0
452         /build/var.run          /var/run        null    rw                      0 0
453         /build/var.spool        /var/spool      null    rw                      0 0
454         tmpfs                   /tmp            tmpfs   rw,noexec,nosuid,nodev  0 0
455         tmpfs                   /var/tmp        tmpfs   rw,noexec,nosuid,nodev  0 0
456         tmpfs                   /var/run/shm    tmpfs   rw                      0 0
457         procfs                  /proc           procfs  rw                      0 0
458
459 The entries that start with a "@" in front are PFSs. This layout is relatively complicated, as it uses
460 separate PFSs for directories that are separately mounted in many UNIX installations. Furthermore,
461 file systems that do need backup are mounted under the /build PFS, which is something like scratch 
462 space in DragonFly. /tmp and /var/tmp are implemented as tmpfs.
463
464 In the following, it is assumed you have already booted the install medium, logged in as root,
465 sliced the hard drive and created your disklabel partitions "a" for /boot, formatted with UFS, "b"
466 for swap, and "d" for /, formatted with HAMMER2. It is furthermore assumed your disk drive is
467 recognised as nvme0.  If your drive is recognised as something else, e.g. da0, you can simply
468 replace nvme0 with da0 in the following commands.
469
470 Note:
471 When creating mount points and mounting disk partitions it is important to keep in mind that the
472 directory hierarchy determines the order of the commands. More specifically, if partition B is to be
473 mounted under a directory of partition A, then first partition A has to be mounted, then the mount
474 point for partition B created on A, and finally partition B mounted. If you proceed first creating the
475 mount points and then mounting the partitions without heeding the hierarchy you will get into
476 trouble :-). Be warned about that.
477
478 So, let's create the layout.
479
480 Mount the disklabel partitions (the swap partition is not mounted): 
481
482         # mount_hammer2 nvme0s1d /mnt
483         # mkdir /mnt/boot
484         # mount nvme0s1a /mnt/boot
485
486 Note that first the / partition is mounted, then the mount point for /boot is created on the mounted
487 /, and finally the /boot partition is mounted. This sequence of commands is determined by the file
488 system hierarchy as discussed in the note above.  
489
490 Create the HAMMER2 PFSs. The path to the mounted HAMMER2 ROOT file system is specified via the -s
491 parameter:
492
493         # hammer2 -s /mnt pfs-create usr
494         # hammer2 -s /mnt pfs-create usr.dports
495         # hammer2 -s /mnt pfs-create usr.local
496         # hammer2 -s /mnt pfs-create usr.src
497         # hammer2 -s /mnt pfs-create var
498         # hammer2 -s /mnt pfs-create home
499         # hammer2 -s /mnt pfs-create build
500
501 To view the created PFSs, you can in between issue:
502
503         # hammer2 pfs-list /mnt
504
505 Create the mount points and mount the PFSs, taking care of the directory hierarchy (see the note
506 above on creating mount points and mounting partitions):
507
508         # mkdir /mnt/usr
509         # mount_hammer2 @usr /mnt/usr
510
511         # mkdir /mnt/usr/dports
512         # mkdir /mnt/usr/local
513         # mkdir /mnt/usr/src
514         # mkdir /mnt/var
515         # mkdir /mnt/build
516          
517         # mount_hammer2 @usr.dports /mnt/usr/dports
518         # mount_hammer2 @usr.local /mnt/usr/local
519         # mount_hammer2 @usr.src /mnt/usr/src
520         # mount_hammer2 @var /mnt/var
521         # mount_hammer2 @build /mnt/build
522
523 Note that among these directories there are such with non-existent (/usr/dports and /usr/src) or
524 empty (/build and /home) counterparts on the install medium. You may ask why /usr/dports
525 and /usr/src are mounted although they will remain empty; the answer is, as cpdup does not cross mount
526 boundaries, this prevents cpdup from asking whether to delete them (because they do not exist on the
527 installation media) when copying /usr from the install medium at a later stage. There is no need to
528 mount /home, as it is an independent file system that will remain empty. On /build, we create
529 directories for file systems that do not normally need backup. At a later stage, we will null-mount
530 these directories to their respective mount points in the hierarchy.
531
532 Create directories for file systems that do not normally need backup:
533
534         # mkdir /mnt/build/usr.distfiles
535         # mkdir /mnt/build/usr.obj
536         # mkdir /mnt/build/var.cache
537         # mkdir /mnt/build/var.crash
538         # mkdir /mnt/build/var.log
539         # mkdir /mnt/build/var.run
540         # mkdir /mnt/build/var.spool
541
542 Create the mount points for the /build null mounts that do not exist on the install medium:
543
544         # mkdir /mnt/usr/distfiles
545
546 Create mount points for the non-empty /build null mounts:
547
548         # mkdir /mnt/var/crash
549         # mkdir /mnt/var/log
550         # mkdir /mnt/var/run
551         # mkdir /mnt/var/spool
552
553 There is no need to create mount points for the empty /build null mounts that exist on the install
554 medium (/usr/obj and /var/cache), as they will be copied by cpdup together with /usr and /var at a
555 later stage. 
556
557 Mount the non-empty /build null mounts:
558
559         # mount_null /mnt/build/var.crash /mnt/var/crash
560         # mount_null /mnt/build/var.log /mnt/var/log
561         # mount_null /mnt/build/var.run /mnt/var/run
562         # mount_null /mnt/build/var.spool /mnt/var/spool
563
564 Mount /usr/distfiles as it does not exist under /usr on the installation media (to prevent cpdup
565 from asking whether to delete it when copying /usr at a later stage):
566
567         # mount_null /build/usr.distfiles /mnt/usr/distfiles
568
569 Install DragonFly by copying the non-empty file systems. Luckily, cpdup won't cross mount boundaries
570 on the source or destination, so it takes a few commands:
571
572         # cpdup / /mnt
573         # cpdup /boot /mnt/boot
574         # cpdup /usr /mnt/usr
575         # cpdup /usr/local /mnt/usr/local
576         # cpdup /var /mnt/var
577
578 Copy the non-empty /build null mounts:
579
580         # cpdup /var/crash /mnt/var/crash
581         # cpdup /var/log /mnt/var/log
582         # cpdup /var/run /mnt/var/run
583         # cpdup /var/spool /mnt/var/spool
584
585 DragonFly BSD uses a different /etc from the one present on the install medium. The /etc on the
586 install medium is only used during installation. It is the /etc.hdd directory that is intended
587 for permanent use. You can delete /etc, but it is preferable to store it under the name /etc.live
588 instead:
589
590         # mv /mnt/etc /mnt/etc.live
591         # mv /mnt/etc.hdd /mnt/etc
592
593 There is no example fstab in /etc.hdd. The one from /etc.live has to be copied:
594
595         # cp /mnt/etc.live/fstab.example /mnt/etc/fstab
596
597 Describe all mounts in fstab:
598
599         # vi /mnt/etc/fstab
600
601 Enter the following content:
602
603         /dev/nvme0s1a /boot ufs rw 1 1
604         /dev/nvme0s1b none swap sw 0 0
605         /dev/nvme0s1d / hammer2 rw 1 1
606         @usr /usr hammer2 rw 0 0
607         @usr.dports /usr/dports hammer2 rw 0 0
608         @usr.local /usr/local hammer2 rw 0 0
609         @usr.src /usr/src hammer2 rw 0 0
610         @var /var hammer2 rw 0 0
611         @home /home hammer2 rw,nosuid 0 0 @build
612         /build hammer2 rw 0 0
613         /build/usr.distfiles /usr/distfiles null rw 0 0
614         /build/usr.obj /usr/obj null rw 0 0
615         /build/var.cache /var/cache null rw 0 0
616         /build/var.crash /var/crash null rw 0 0
617         /build/var.log /var/log null rw 0 0
618         /build/var.run /var/run null rw 0 0
619         /build/var.spool /var/spool null rw 0 0
620         tmpfs /tmp tmpfs rw,nosuid,noexec,nodev 0 0
621         tmpfs /var/tmp tmpfs rw,nosuid,noexec,nodev 0 0
622         proc /proc procfs rw 0 0
623         
624 Now, specify the correct root file system:
625
626         # vi /mnt/boot/loader.conf
627
628 Add the following content:
629
630         vfs.root.mountfrom="hammer2:nvme0s1d"
631
632 Unmount mounted filesystems:
633
634         # umount /mnt/boot
635         # umount /mnt/usr/distfiles
636         # umount /mnt/usr/dports
637         # umount /mnt/usr/local
638         # umount /mnt/usr/src
639         # umount /mnt/var/crash
640         # umount /mnt/var/log
641         # umount /mnt/var/run
642         # umount /mnt/var/spool
643         # umount /mnt/usr
644         # umount /mnt/var
645         # umount /mnt/build
646         # umount /mnt
647
648 Halt to give you time to remove the install medium:
649
650         # halt
651
652 Wait for the system to halt, remove the installation medium after that, and finally press any key to
653 reboot.
654