Markus Schatzl Written by Justin Sherrill Installation from CD CD Installation Overview This document describes the installation of DragonFly BSD on a plain i386 machine. This process uses a bootable DragonFly CD, usually referred to as a 'live CD'. This CD is available at one of the current mirrors, which distribute the images by various protocols. The authorative list can be found at the DragonFly website. This document may be superseded by the /README file located on the live CD, which may reflect changes made after this document was last updated. Check that README for any last-minute changes and for an abbreviated version of this installation process. The DragonFly development team is working on an automatic installation tool, which simplifies the partitioning and installation processes. Until this tool is in place, the manual process here is required. Some experience with BSD-style tools is recommended. While this guide covers installing to a computer with an existing non-DragonFly operating system, take no chances! Back up any data on your disk drives that you want to save. When installing to an old machine, it may not be possible to boot from a CD. Use a bootmanager on a floppy in those cases, such as Smart Bootmanager. Always be sure of the target disk for any command. Unless otherwise specified, each command here assumes the first disk in the IDE chain is the target. (ad0) Adjust commands as needed. CD Installation - Making room DragonFly as the only operating system If DragonFly is to be the only operating system on the target computer, preparing the disk is a short and simple process. Boot with the live CD, and log in as root to reach a command prompt. First, the master boot record (MBR) must be cleared of any old information. This command clears all old data off your disk by writing zeros (if=/dev/zero) onto the system's master ata drive (of=/dev/ad0). &prompt.root; dd if=/dev/zero of=/dev/ad0 bs=32k count=16 The now-empty disk must be formatted. This will destroy any existing data on a disk. Do this only if you plan to dedicate this disk to DragonFly. &prompt.root; fdisk -I ad0 &prompt.root; fdisk -B ad0 Multiple operating systems on one hard disk This example assumes that the target computer for installation has at least one operating system installed that needs to survive the installation process. A new partition for DragonFly needs to be created from the existing partition(s) that otherwise fill the disk. There must be unused space within the existing partition in order to resize it. The new partition is created from empty space in an existing partition. For example, an 18 gigabyte disk that has 17 gigabytes of existing data in the existing partition will only have 1 gigabyte available for the new partition. Partition resizing needs to be accomplished with a third-party tool. Commercial programs such as Partition Magic can accomplish these tasks. Free tools exist that can be adapted to this task, such as 'GNU parted', found on the Knoppix CD, or PAUD. Create a new partition of at least 5-6 gigabytes. It is possible to install within a smaller amount of disk space, but this will create problems not covered by this document. The newly created partition does not need to be formatted; the rest of the installation process treats that new partiton as a new disk. Multiple operating systems, multiple hard disks Installing DragonFly to a separate disk removes the need for partition resizing, and is generally safer when trying to preserve an existing operating system installation. This type of installation is very similar to installing DragonFly as the only operating system. The only difference is the disk named in each command. CD Installation - Disk setup Disk formatting The slice layout on the newly formatted disk or partition needs to be set up, using this command. &prompt.root; fdisk -u If there are multiple operating systems on the disk, pick the correct partition judging by what partitions were created earlier with a resizing tool. Boot block installation The 'ad0' here refers to the first disk on the first IDE bus of a computer. Increment the number if the target disk is farther down the chain. For example, the master disk on the second IDE controller would be 'ad2'. &prompt.root; boot0cfg -B ad0 &prompt.root; boot0cfg -v ad0 -s SLICE, where SLICE is a number, controls which slice on disk is used by boot0cfg to start from. By default, this number is 1, and will only need modification if a different slice contains DragonFly. Use -o packet as an option to boot0cfg if the DragonFly partition is located beyond cylinder 1023 on the disk. This location problem usually only happens when another operating system is taking up more than the first 8 gigabytes of disk space. This problem cannot happen if DragonFly is installed to a dedicated disk Disklabel If DragonFly is installed anywhere but the first partition of the disk, the device entry for that partition will have to be created. Otherwise, the device entry is automatically created. Refer to this different partition instead of the 'ad0s1a' used in later examples. &prompt.root; cd /dev; ./MAKEDEV ad0s2 The partition needs to be created on the DragonFly disk. &prompt.root; disklabel -B -r -w ad0s1 auto Using /etc/disklabel.ad0s1 as an example, issue the following command to edit the disklabel for the just-created partition. &prompt.root; disklabel -e ad0s1 Partition Size Mountpoint ad0s2a 256m / ad0s2b 1024m swap ad0s2c leave alone This represents the whole slice. ad0s2d 256m /var ad0s2e 256m /tmp ! ad0s2f 8192m /usr - This should be at least 4096m ad0s2g * /home - This holds 'everything else' Partition Format newfs will format each individual partition. &prompt.root; newfs /dev/ad0s1a &prompt.root; newfs -U /dev/ad0s1d &prompt.root; newfs -U /dev/ad0s1e &prompt.root; newfs -U /dev/ad0s1f &prompt.root; newfs -U /dev/ad0s1g The -U option is not used for the root partition, since / is usually relatively small. Softupdates can cause it to run out of space while under a lot of disk activity, such as a buildworld. The command listing skips directly from ad0s1a to ad0s1d. This is because /dev/ad0s1b is used as swap and does not require formatting; ad0s1c refers to the entire disk and should not be formatted. Installing to Disk Since the Live CD contains all needed data to create a running DragonFly system, the simplest installation possible is to copy the Live CD data to the newly formatted disk/partition created in previous steps. These commands mount the newly created disk space and create the appropriate directories on it. &prompt.root; mount /dev/ad0s1a /mnt &prompt.root; mkdir /mnt/var &prompt.root; mkdir /mnt/tmp &prompt.root; mkdir /mnt/usr &prompt.root; mkdir /mnt/home &prompt.root; mount /dev/ad0s1d /mnt/var &prompt.root; mount /dev/ad0s1e /mnt/tmp &prompt.root; mount /dev/ad0s1f /mnt/usr &prompt.root; mount /dev/ad0s1g /mnt/home cpdup duplicates data from one volume to another. These commands copy data from the Live CD to the newly created directories on the mounted disk. Each step can take some time, depending on disk speed. &prompt.root; cpdup / /mnt &prompt.root; cpdup /var /mnt/var &prompt.root; cpdup /etc /mnt/etc &prompt.root; cpdup /dev /mnt/dev &prompt.root; cpdup /usr /mnt/usr Nothing is copied to the /tmp directory that was created in the previous step. This is not an error, since /tmp is intended only for temporary storage. CD Installation - Post-install cleanup /tmp and /var/tmp are both often used as temporary directories. Since use is not consistent from application to application, it is worthwhile to create /tmp as a link to /var/tmp so space is not wasted in duplication. &prompt.root; chmod 1777 /mnt/tmp &prompt.root; rm -fr /mnt/var/tmp &prompt.root; ln -s /tmp /mnt/var/tmp /tmp will not work until the computer is rebooted. The file /etc/fstab describes the disk partition layout. However, the version copied to the target disk only reflects the Live CD layout. The installed /mnt/fstab.example can be used as a starting point for creating a new /etc/fstab. &prompt.root; vi /mnt/etc/fstab.example &prompt.root; mv /mnt/etc/fstab.example /mnt/etc/fstab A corrupted disklabel will render a disk useless. While this is thankfully very rare, having a backup of the new install's disklabel may stave off disaster at some point in the future. This is optional. (Adjust the slice name to reflect the actual installation.) &prompt.root; disklabel ad0s1 > /mnt/etc/disklabel.backup Nothing is copied to the /tmp directory that was created in the previous step. This is not an error, since /tmp is intended only for temporary storage. Remove some unnecessary files copied over from the Live CD. &prompt.root; rm /mnt/boot/loader.conf &prompt.root; rm /mnt/boot.catalog &prompt.root; rm -r /mnt/rr_moved The system can now be rebooted. Be sure to remove the Live CD from the CDROM drive so that the computer can boot from the newly-installed disk. &prompt.root; reboot Use the reboot command so that the disk can be unmounted cleanly. Hitting the power or reset buttons, while it won't hurt the Live CD, can leave the mounted disk in a inconsistent state. If the system refuses to boot, there are several options to try: Old bootblocks can interfere with the initialization-process. To avoid this, zero-out the MBR. "of" should be changed to the correct disk entry if ad0 is not the targeted installation disk. &prompt.root; dd if=/dev/zero of=/dev/ad0 bs=32 count=16 It is possible that the DragonFly slice is beyond cylinder 1023 on the hard disk, and can't be detected. Packet mode can fix this problem. &prompt.root; boot0cfg -o packet ad0 If you can select CHS or LBA mode in your BIOS, try changing the mode to LBA. After a successful boot from the newly installed hard drive, the timezone should be set. Use the command tzsetup to set the appropriate time zone. &prompt.root; tzsetup CD Installation - New system setup Once the new DragonFly system is booting from disk, there are a number of steps that may be useful before working further. The file /etc/rc.conf controls a number of options for booting the system. Setting up rc.conf Depending on location, a different keyboard map may be needed. This is only necessary for computers outside of North America. &prompt.root; kbdmap Pick the appropriate keyboard map and remember the name. Place this name in /etc/rc.conf. For example: keymap="german.iso.kbd" The file /etc/rc.conf matches the one on the Live CD. Since it is now on an installed system are no longer running in a read-only environment, some changes should be made. Changes to this file will take effect after the next boot of the machine. These lines can be removed. syslogd_enable="NO" xntpd_enable="NO" cron_enable="NO" For a system which uses USB, this line will need to be modified to a value of "YES": usbd_enable="NO" inetd controls various small servers like telnet or ftp. By default, all servers are off, and must be individually uncommented in /etc/inetd.conf to start them. This is optional. inetd_enable="YES" # Run the network daemon dispatcher (YES/NO). inetd_program="/usr/sbin/inetd" # path to inetd, if you want a different one. inetd_flags="-wW" # Optional flags to inetd Network Setup For acquiring an IP address through DHCP, place this entry in /etc/rc.conf, using the appropriate card name. (ep0 is used as an example here.) ifconfig_ep0="DHCP" For a fixed IP, /etc/rc.conf requires a few more lines of data. (Again, ep0 is used as an example here.) Supply the correct local values for IP, netmask, and default router. The hostname should reflect what is entered in DNS for this computer. ifconfig_ep0="inet 123.234.345.456 netmask 255.255.255.0" hostname="myhostname" defaultrouter="654.543.432.321"