From 0b1da5721274a545a9e2157ffc5315b2176bbfe7 Mon Sep 17 00:00:00 2001 From: Michael Lucas Date: Mon, 21 Jan 2002 20:09:42 +0000 Subject: [PATCH] Cut the System Administration chapter roughly in half. Create a new chapter: Disks, Filesystems, and Boot Loaders. Put new chapter in rough order: *new hard disks *UFS tricks *foreign filesystems *foreign loaders *removeable disks *misc This makes the monstrous System Administration chapter short enough to be almost usable. Discussed by: -doc --- en_US.ISO8859-1/books/faq/book.sgml | 1250 ++++++++++++++------------- 1 file changed, 628 insertions(+), 622 deletions(-) diff --git a/en_US.ISO8859-1/books/faq/book.sgml b/en_US.ISO8859-1/books/faq/book.sgml index 5f7a0f0cd9..5751069b4b 100644 --- a/en_US.ISO8859-1/books/faq/book.sgml +++ b/en_US.ISO8859-1/books/faq/book.sgml @@ -5637,80 +5637,10 @@ device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr - - System Administration + + Disks, Filesystems, and Boot Loaders - - - Where are the system start-up configuration files? - - - - - From 2.0.5R to 2.2.1R, the primary configuration file is - /etc/sysconfig. All the options are to be - specified in this file and other files such as - /etc/rc (see &man.rc.8;) - and /etc/netstart just include it. - - Look in the /etc/sysconfig file and - change the value to match your system. This file is filled with - comments to show what to put in there. - - In post-2.2.1 and 3.0, /etc/sysconfig - was renamed to a more self-describing &man.rc.conf.5; - file and the syntax cleaned up a bit in the process. - /etc/netstart was also renamed to - /etc/rc.network so that all files could be - copied with a - cp - /usr/src/etc/rc* /etc command. - - And, in 3.1 and later, /etc/rc.conf - has been moved to /etc/defaults/rc.conf. - Do not edit this file! Instead, if there - is any entry in /etc/defaults/rc.conf that - you want to change, you should copy the line into - /etc/rc.conf and change it there. - - For example, if you wish to start named, the DNS server - included with FreeBSD in FreeBSD 3.1 or later, all you need to - do is: - &prompt.root; echo named_enable="YES" >> /etc/rc.conf - - To start up local services in FreeBSD 3.1 or later, place - shell scripts in the /usr/local/etc/rc.d - directory. These shell scripts should be set executable, and - end with a .sh. In FreeBSD 3.0 and earlier releases, you should - edit the /etc/rc.local file. - - The /etc/rc.serial is for serial port - initialization (e.g. locking the port characteristics, and so - on.). - - The /etc/rc.i386 is for Intel-specifics - settings, such as iBCS2 emulation or the PC system console - configuration. - - - - - - How do I add a user easily? - - - - Use the &man.adduser.8; - command. For more complicated usage, the &man.pw.8; - command. - - To remove the user again, use the &man.rmuser.8; - command. Once again, &man.pw.8; will work as - well. - - - How can I add my new hard disk to my FreeBSD system? @@ -5724,196 +5654,328 @@ device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr - - I have a new removable drive, how do I use it? + + How do I move my system over to my huge new disk? + The best way is to reinstall the OS on the new + disk, then move the user data over. This is highly + recommended if you have been tracking -stable for more + than one release, or have updated a release instead of + installing a new one. You can install booteasy on both + disks with &man.boot0cfg.8;, and dual boot them until + you are happy with the new configuration. Skip the + next paragraph to find out how to move the data after + doing this. - Whether it is a removable drive like a ZIP or an EZ drive - (or even a floppy, if you want to use it that way), or a new - hard disk, once it is installed and recognized by the system, - and you have your cartridge/floppy/whatever slotted in, things - are pretty much the same for all devices. + Should you decide not to do a fresh install, you + need to partition and label the new disk with either + /stand/sysinstall, or &man.fdisk.8; + and &man.disklabel.8;. You should also install booteasy + on both disks with &man.boot0cfg.8;, so that you can + dual boot to the old or new system after the copying + is done. See the + formatting-media article for details on this + process. - (this section is based on - Mark Mayo's ZIP FAQ) + Now you have the new disk set up, and are ready + to move the data. Unfortunately, you cannot just blindly + copy the data. Things like device files (in + /dev), flags, and links tend to + screw that up. You need to use tools that understand + these things, which means &man.dump.8;. + Although it is suggested that you move the data in single user + mode, it is not required. - If it is a ZIP drive or a floppy , you have already got a DOS - filesystem on it, you can use a command like this: + You should never use anything but &man.dump.8; and + &man.restore.8; to move the root file system. The + &man.tar.1; command may work - then again, it may not. + You should also use &man.dump.8; and &man.restore.8; + if you are moving a single partition to another empty + partition. The sequence of steps to use dump to move + a partitions data to a new partition is: - &prompt.root; mount -t msdos /dev/fd0c /floppy + + + newfs the new partition. + - if it is a floppy, or this: + + mount it on a temporary mount point. + - &prompt.root; mount -t msdos /dev/da2s4 /zip + + cd to that directory. + - for a ZIP disk with the factory configuration. + + dump the old partition, piping output to the + new one. + + - For other disks, see how they are laid out using - &man.fdisk.8; or - &man.sysinstall.8;. + For example, if you are going to move root to + /dev/ad1s1a, with + /mnt as the temporary mount point, + it is: - The rest of the examples will be for a ZIP drive on da2, - the third SCSI disk. + &prompt.root; newfs /dev/ad1s1a +&prompt.root; mount /dev/ad1s1a /mnt +&prompt.root; cd /mnt +&prompt.root; dump 0af - / | restore xf - - Unless it is a floppy, or a removable you plan on sharing - with other people, it is probably a better idea to stick a BSD - file system on it. You will get long filename support, at least a - 2X improvement in performance, and a lot more stability. First, - you need to redo the DOS-level partitions/filesystems. You can - either use &man.fdisk.8; or - /stand/sysinstall, or for a small drive - that you do not want to bother with multiple operating system - support on, just blow away the whole FAT partition table - (slices) and just use the BSD partitioning: + Rearranging your partitions with dump takes a bit more + work. To merge a partition like /var + into its parent, create the new partition large enough + for both, move the parent partition as described above, + then move the child partition into the empty directory + that the first move created: + + &prompt.root; newfs /dev/ad1s1a +&prompt.root; mount /dev/ad1s1a /mnt +&prompt.root; cd /mnt +&prompt.root; dump 0af - / | restore xf - +&prompt.root; cd var +&prompt.root; dump 0af - /var | restore xf - - &prompt.root; dd if=/dev/zero of=/dev/rda2 count=2 -&prompt.root; disklabel -Brw da2 auto + To split a directory from its parent, say putting + /var on its own partition when it was not + before, create both partitions, then mount the child partition + on the appropriate directory in the temporary mount point, then + move the old single partition: - You can use disklabel or - /stand/sysinstall to create multiple BSD - partitions. You will certainly want to do this if you are adding - swap space on a fixed disk, but it is probably irrelevant on a - removable drive like a ZIP. + &prompt.root; newfs /dev/ad1s1a +&prompt.root; newfs /dev/ad1s1d +&prompt.root; mount /dev/ad1s1a /mnt +&prompt.root; mkdir /mnt/var +&prompt.root; mount /dev/ad1s1d /mnt/var +&prompt.root; cd /mnt +&prompt.root; dump 0af - / | restore xf - - Finally, create a new file system, this one is on our ZIP - drive using the whole disk: - - &prompt.root; newfs /dev/rda2c - - and mount it: - - &prompt.root; mount /dev/da2c /zip - - and it is probably a good idea to add a line like this to - /etc/fstab (see &man.fstab.5;) so you can just type - mount /zip in the future: - - /dev/da2c /zip ffs rw,noauto 0 0 + You might prefer &man.cpio.1;, &man.pax.1;, + &man.tar.1; to &man.dump.8; for user data. At the time of + this writing, these are known to lose file flag information, + so use them with caution. - - Why do I keep getting messages like root: not - found after editing my crontab file? + + Will a dangerously dedicated disk endanger + my health? - This is normally caused by editing the system crontab - (/etc/crontab) and then using - &man.crontab.1; to install it: - &prompt.root; crontab /etc/crontab + The installation procedure allows + you to chose two different methods in partitioning your + harddisk(s). The default way makes it compatible with other + operating systems on the same machine, by using fdisk table + entries (called slices in FreeBSD), with a + FreeBSD slice that employs partitions of its own. Optionally, + one can chose to install a boot-selector to switch between the + possible operating systems on the disk(s). The alternative uses + the entire disk for FreeBSD, and makes no attempt to be + compatible with other operating systems. - This is not the correct way to do things. The system - crontab has a different format to the per-user crontabs - which &man.crontab.1; updates (the &man.crontab.5; manual - page explains the differences in more detail). + So why it is called dangerous? A disk in + this mode does not contain what normal PC utilities would + consider a valid fdisk table. Depending on how well they have + been designed, they might complain at you once they are getting + in contact with such a disk, or even worse, they might damage + the BSD bootstrap without even asking or notifying you. In + addition, the dangerously dedicated disk's + layout is known to confuse many BIOSsen, including those from + AWARD (eg. as found in HP Netserver and Micronics systems as + well as many others) and Symbios/NCR (for the popular 53C8xx + range of SCSI controllers). This is not a complete list, there + are more. Symptoms of this confusion include the read + error message printed by the FreeBSD bootstrap when it + cannot find itself, as well as system lockups when + booting. - If this is what you did, the extra crontab is simply a - copy of /etc/crontab in the wrong - format it. Delete it with the command: + Why have this mode at all then? It only saves a few kbytes + of disk space, and it can cause real problems for a new + installation. Dangerously dedicated mode's + origins lie in a desire to avoid one of the most common + problems plaguing new FreeBSD installers - matching the BIOS + geometry numbers for a disk to the disk + itself. - &prompt.root; crontab -r + Geometry is an outdated concept, but one + still at the heart of the PC's BIOS and its interaction with + disks. When the FreeBSD installer creates slices, it has to + record the location of these slices on the disk in a fashion + that corresponds with the way the BIOS expects to find them. If + it gets it wrong, you will not be able to boot. - Next time, when you edit - /etc/crontab, you should not do - anything to inform &man.cron.8; of the changes, since it - will notice them automatically. + Dangerously dedicated mode tries to work + around this by making the problem simpler. In some cases, it + gets it right. But it is meant to be used as a last-ditch + alternative - there are better ways to solve the problem 99 + times out of 100. - If you want something to be run once per day, week, or - month, it is probably better to add shell scripts - /usr/local/etc/periodic, and let the - &man.periodic.8; command run from the system cron schedule - it with the other periodic system tasks. + So, how do you avoid the need for DD mode + when you are installing? Start by making a note of the geometry + that your BIOS claims to be using for your disks. You can + arrange to have the kernel print this as it boots by specifying + at the boot: prompt, or + using boot -v in the loader. Just before the + installer starts, the kernel will print a list of BIOS + geometries. Do not panic - wait for the installer to start and + then use scrollback to read the numbers. Typically the BIOS + disk units will be in the same order that FreeBSD lists your + disks, first IDE, then SCSI. - The actual reason for the error is that the system - crontab has an extra field, specifying which user to run the - command as. In the default system crontab provided with - FreeBSD, this is root for all entries. - When this crontab is used as the root - user's crontab (which is not the - same as the system crontab), &man.cron.8; assumes the string - root is the first word of the command to - execute, but no such command exists. + When you are slicing up your disk, check that the disk + geometry displayed in the FDISK screen is correct (ie. it + matches the BIOS numbers); if it is wrong, use the + g key to fix it. You may have to do this if + there is absolutely nothing on the disk, or if the disk has been + moved from another system. Note that this is only an issue with + the disk that you are going to boot from; FreeBSD will sort + itself out just fine with any other disks you may have. + + Once you have got the BIOS and FreeBSD agreeing about the + geometry of the disk, your problems are almost guaranteed to be + over, and with no need for DD mode at all. If, + however, you are still greeted with the dreaded read + error message when you try to boot, it is time to cross + your fingers and go for it - there is nothing left to + lose. + + To return a dangerously dedicated disk + for normal PC use, there are basically two options. The first + is, you write enough NULL bytes over the MBR to make any + subsequent installation believe this to be a blank disk. You + can do this for example with + + &prompt.root; dd if=/dev/zero of=/dev/rda0 count=15 + + Alternatively, the undocumented DOS + feature + + C:\> fdisk /mbr + + will to install a new master boot record as well, thus + clobbering the BSD bootstrap. - - Why do I get the error, you are not in the correct - group to su root when I try to su to root? - - - - This is a security feature. In order to su to - root (or any other account with superuser - privileges), you must be in the wheel - group. If this feature were not there, anybody with an account - on a system who also found out root's - password would be able to gain superuser level access to the - system. With this feature, this is not strictly true; - &man.su.1; will prevent them from even trying to enter the - password if they are not in wheel. - - To allow someone to su to root, simply - put them in the wheel group. - - - - - - I made a mistake in rc.conf, - or another startup file, and - now I cannot edit it because the filesystem is read-only. - What should I do? + + Which partitions can safely use softupdates? I have + heard that softupdates on / can cause + problems. - When you get the prompt to enter the shell - pathname, simply press ENTER, and run - mount / to re-mount the root filesystem in - read/write mode. You may also need to run mount -a -t - ufs to mount the filesystem where your favourite - editor is defined. If your favourite editor is on a network - filesystem, you will need to either configure the network - manually before you can mount network filesystems, or use an - editor which resides on a local filesystem, such as - &man.ed.1;. + Short answer: you can usually use softupdates safely + on all partitions. - If you intend to use a full screen editor such - as &man.vi.1; or &man.emacs.1;, you may also need to - run export TERM=cons25 so that these - editors can load the correct data from the &man.termcap.5; - database. + Long answer: There used to be some concern over using + softupdates on the root partition. Softupdates has two + characteristics that caused this. First, a softupdates + partition has a small chance of losing data during a + system crash. (The partition will not be corrupted; the + data will simply be lost.) Also, softupdates can cause + temporary space shortages. - Once you have performed these steps, you can edit - /etc/rc.conf as you usually would - to fix the syntax error. The error message displayed - immediately after the kernel boot messages should tell you - the number of the line in the file which is at fault. + When using softupdates, the kernel can take up to + thirty seconds to actually write changes to the physical + disk. If you delete a large file, the file still resides + on disk until the kernel actually performs the deletion. + This can cause a very simple race condition. Suppose you + delete one large file and immediately create another large + file. The first large file is not yet actually removed + from the physical disk, so the disk might not have enough + room for the second large file. You get an error that the + partition does not have enough space, although you know + perfectly well that you just released a large chunk of + space! When you try again mere seconds later, the file + creation works as you expect. This has left more than one + user scratching his head and doubting his sanity, the + FreeBSD filesystem, or both. + + If a system should crash after the kernel accepts a + chunk of data for writing to disk, but before that data is + actually written out, data could be lost or corrupted. + This risk is extremely small, but generally manageable. + Use of IDE write caching greatly increases this risk; it + is strongly recommended that you disable IDE write caching + when using softupdates. + + These issues affect all partitions using softupdates. + So, what does this mean for the root partition? + + Vital information on the root partition changes very + rarely. Files such as /kernel and + the contents of /etc only change + during system maintenance, or when users change their + passwords. If the system crashed during the + thirty-second window after such a change is made, it is + possible that data could be lost. This risk is negligible + for most applications, but you should be aware that it + exists. If your system cannot tolerate this much risk, + do not use softupdates on the root filesystem! + + / is traditionally one of the + smallest partitions. By default, FreeBSD puts the + /tmp directory on + /. If you have a busy + /tmp, you might see intermittent + space problems. Symlinking /tmp to + /var/tmp will solve this + problem. - - How do I mount a secondary DOS partition? + + What is inappropriate about my ccd? + The symptom of this is: - The secondary DOS partitions are found after ALL the primary - partitions. For example, if you have an E - partition as the second DOS partition on the second SCSI drive, - you need to create the special files for slice 5 - in /dev, then mount /dev/da1s5: + &prompt.root; ccdconfig -C +ccdconfig: ioctl (CCDIOCSET): /dev/ccd0c: Inappropriate file type or format - &prompt.root; cd /dev -&prompt.root; sh MAKEDEV da1s5 -&prompt.root; mount -t msdos /dev/da1s5 /dos/e + This usually happens when you are trying to concatenate + the c partitions, which default to type + unused. The ccd driver requires the + underlying partition type to be FS_BSDFFS. Edit the disklabel + of the disks you are trying to concatenate and change the types + of partitions to 4.2BSD. + + + + + + Why can I not edit the disklabel on my ccd? + + + + The symptom of this is: + + &prompt.root; disklabel ccd0 +(it prints something sensible here, so let us try to edit it) +&prompt.root; disklabel -e ccd0 +(edit, save, quit) +disklabel: ioctl DIOCWDINFO: No disk label on disk; +use "disklabel -r" to install initial label + + This is because the disklabel returned by ccd is actually + a fake one that is not really on the disk. + You can solve this problem by writing it back explicitly, + as in: + + &prompt.root; disklabel ccd0 > /tmp/disklabel.tmp +&prompt.root; disklabel -Rr ccd0 /tmp/disklabel.tmp +&prompt.root; disklabel -e ccd0 +(this will work now) @@ -5965,34 +6027,31 @@ device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr - - How can I create an image of a data CD? + + How do I mount a secondary DOS partition? - If you want to make a bit-by-bit copy of a CD (so you - can, for example, duplicate it with a CD burner), use - &man.dd.1;. The example given here assumes that you have - a IDE CDROM device that shows up as - acd0. If you have a SCSI CD - or different type of drive, you will want to substitute - the correct device name. A c must be - appended to the end of the device name, indicating - the entire partition, or in the case of CDROMs, the entire - disc. - &prompt.root; dd if=/dev/acd0c of=file.iso bs=2048 + The secondary DOS partitions are found after ALL the primary + partitions. For example, if you have an E + partition as the second DOS partition on the second SCSI drive, + you need to create the special files for slice 5 + in /dev, then mount /dev/da1s5: - The file generated will be a standard ISO file, which - can be used with cdrecord, - burncd, or any other program - supporting this standard CD data format. This method does - not work with audio CDs. + &prompt.root; cd /dev +&prompt.root; sh MAKEDEV da1s5 +&prompt.root; mount -t msdos /dev/da1s5 /dos/e + + - For more on working with CDROMs, see the - Creating - CDs Section in the Storage chapter - in the Handbook. + + + Is there a cryptographic filesystem for &os;? + + + + Yes; see the security/cfs port. @@ -6157,105 +6216,176 @@ C:\="DOS" - - Will a dangerously dedicated disk endanger - my health? + + I have a new removable drive, how do I use it? - The installation procedure allows - you to chose two different methods in partitioning your - harddisk(s). The default way makes it compatible with other - operating systems on the same machine, by using fdisk table - entries (called slices in FreeBSD), with a - FreeBSD slice that employs partitions of its own. Optionally, - one can chose to install a boot-selector to switch between the - possible operating systems on the disk(s). The alternative uses - the entire disk for FreeBSD, and makes no attempt to be - compatible with other operating systems. + Whether it is a removable drive like a ZIP or an EZ drive + (or even a floppy, if you want to use it that way), or a new + hard disk, once it is installed and recognized by the system, + and you have your cartridge/floppy/whatever slotted in, things + are pretty much the same for all devices. - So why it is called dangerous? A disk in - this mode does not contain what normal PC utilities would - consider a valid fdisk table. Depending on how well they have - been designed, they might complain at you once they are getting - in contact with such a disk, or even worse, they might damage - the BSD bootstrap without even asking or notifying you. In - addition, the dangerously dedicated disk's - layout is known to confuse many BIOSsen, including those from - AWARD (eg. as found in HP Netserver and Micronics systems as - well as many others) and Symbios/NCR (for the popular 53C8xx - range of SCSI controllers). This is not a complete list, there - are more. Symptoms of this confusion include the read - error message printed by the FreeBSD bootstrap when it - cannot find itself, as well as system lockups when - booting. + (this section is based on + Mark Mayo's ZIP FAQ) - Why have this mode at all then? It only saves a few kbytes - of disk space, and it can cause real problems for a new - installation. Dangerously dedicated mode's - origins lie in a desire to avoid one of the most common - problems plaguing new FreeBSD installers - matching the BIOS - geometry numbers for a disk to the disk - itself. + If it is a ZIP drive or a floppy , you have already got a DOS + filesystem on it, you can use a command like this: - Geometry is an outdated concept, but one - still at the heart of the PC's BIOS and its interaction with - disks. When the FreeBSD installer creates slices, it has to - record the location of these slices on the disk in a fashion - that corresponds with the way the BIOS expects to find them. If - it gets it wrong, you will not be able to boot. + &prompt.root; mount -t msdos /dev/fd0c /floppy - Dangerously dedicated mode tries to work - around this by making the problem simpler. In some cases, it - gets it right. But it is meant to be used as a last-ditch - alternative - there are better ways to solve the problem 99 - times out of 100. + if it is a floppy, or this: - So, how do you avoid the need for DD mode - when you are installing? Start by making a note of the geometry - that your BIOS claims to be using for your disks. You can - arrange to have the kernel print this as it boots by specifying - at the boot: prompt, or - using boot -v in the loader. Just before the - installer starts, the kernel will print a list of BIOS - geometries. Do not panic - wait for the installer to start and - then use scrollback to read the numbers. Typically the BIOS - disk units will be in the same order that FreeBSD lists your - disks, first IDE, then SCSI. + &prompt.root; mount -t msdos /dev/da2s4 /zip - When you are slicing up your disk, check that the disk - geometry displayed in the FDISK screen is correct (ie. it - matches the BIOS numbers); if it is wrong, use the - g key to fix it. You may have to do this if - there is absolutely nothing on the disk, or if the disk has been - moved from another system. Note that this is only an issue with - the disk that you are going to boot from; FreeBSD will sort - itself out just fine with any other disks you may have. + for a ZIP disk with the factory configuration. - Once you have got the BIOS and FreeBSD agreeing about the - geometry of the disk, your problems are almost guaranteed to be - over, and with no need for DD mode at all. If, - however, you are still greeted with the dreaded read - error message when you try to boot, it is time to cross - your fingers and go for it - there is nothing left to - lose. + For other disks, see how they are laid out using + &man.fdisk.8; or + &man.sysinstall.8;. - To return a dangerously dedicated disk - for normal PC use, there are basically two options. The first - is, you write enough NULL bytes over the MBR to make any - subsequent installation believe this to be a blank disk. You - can do this for example with + The rest of the examples will be for a ZIP drive on da2, + the third SCSI disk. - &prompt.root; dd if=/dev/zero of=/dev/rda0 count=15 + Unless it is a floppy, or a removable you plan on sharing + with other people, it is probably a better idea to stick a BSD + file system on it. You will get long filename support, at least a + 2X improvement in performance, and a lot more stability. First, + you need to redo the DOS-level partitions/filesystems. You can + either use &man.fdisk.8; or + /stand/sysinstall, or for a small drive + that you do not want to bother with multiple operating system + support on, just blow away the whole FAT partition table + (slices) and just use the BSD partitioning: - Alternatively, the undocumented DOS - feature + &prompt.root; dd if=/dev/zero of=/dev/rda2 count=2 +&prompt.root; disklabel -Brw da2 auto - C:\> fdisk /mbr + You can use disklabel or + /stand/sysinstall to create multiple BSD + partitions. You will certainly want to do this if you are adding + swap space on a fixed disk, but it is probably irrelevant on a + removable drive like a ZIP. - will to install a new master boot record as well, thus - clobbering the BSD bootstrap. + Finally, create a new file system, this one is on our ZIP + drive using the whole disk: + + &prompt.root; newfs /dev/rda2c + + and mount it: + + &prompt.root; mount /dev/da2c /zip + + and it is probably a good idea to add a line like this to + /etc/fstab (see &man.fstab.5;) so you can just type + mount /zip in the future: + + /dev/da2c /zip ffs rw,noauto 0 0 + + + + + + How can I create an image of a data CD? + + + + If you want to make a bit-by-bit copy of a CD (so you + can, for example, duplicate it with a CD burner), use + &man.dd.1;. The example given here assumes that you have + a IDE CDROM device that shows up as + acd0. If you have a SCSI CD + or different type of drive, you will want to substitute + the correct device name. A c must be + appended to the end of the device name, indicating + the entire partition, or in the case of CDROMs, the entire + disc. + + &prompt.root; dd if=/dev/acd0c of=file.iso bs=2048 + + The file generated will be a standard ISO file, which + can be used with cdrecord, + burncd, or any other program + supporting this standard CD data format. This method does + not work with audio CDs. + + For more on working with CDROMs, see the + Creating + CDs Section in the Storage chapter + in the Handbook. + + + + + + How do I let ordinary users mount floppies, CDROMs and other removable + media? + + + + Ordinary users can be permitted to mount devices. Here is + how: + + + + As root set the sysctl variable + vfs.usermount to + 1. + + &prompt.root; sysctl -w vfs.usermount=1 + + + + As root assign the appropriate + permissions to the block device associated with the + removable media. + + For example, to allow users to mount the first floppy + drive, use: + + &prompt.root; chmod 666 /dev/fd0 + + To allow users in the group + operator to mount the CDROM drive, + use: + + &prompt.root; chgrp operator /dev/cd0c +&prompt.root; chmod 640 /dev/cd0c + + + + Finally, add the line + vfs.usermount=1 to the file + /etc/sysctl.conf so that it is reset + at system boot time. + + + + All users can now mount the floppy + /dev/fd0 onto a directory that they + own: + + &prompt.user; mkdir ~/my-mount-point +&prompt.user; mount -t msdos /dev/fd0 ~/my-mount-point + + Users in group operator can now + mount the CDROM /dev/cd0c onto a + directory that they own: + + &prompt.user; mkdir ~/my-mount-point +&prompt.user; mount -t msdos /dev/cd0c ~/my-mount-point + + Unmounting the device is simple: + + &prompt.user; umount ~/my-mount-point + + Enabling vfs.usermount, however, has + negative security implications. A better way to access MSDOS + formatted media is to use the mtools package in the ports collection. @@ -6314,74 +6444,6 @@ C:\="DOS" - - - Which partitions can safely use softupdates? I have - heard that softupdates on / can cause - problems. - - - - Short answer: you can usually use softupdates safely - on all partitions. - - Long answer: There used to be some concern over using - softupdates on the root partition. Softupdates has two - characteristics that caused this. First, a softupdates - partition has a small chance of losing data during a - system crash. (The partition will not be corrupted; the - data will simply be lost.) Also, softupdates can cause - temporary space shortages. - - When using softupdates, the kernel can take up to - thirty seconds to actually write changes to the physical - disk. If you delete a large file, the file still resides - on disk until the kernel actually performs the deletion. - This can cause a very simple race condition. Suppose you - delete one large file and immediately create another large - file. The first large file is not yet actually removed - from the physical disk, so the disk might not have enough - room for the second large file. You get an error that the - partition does not have enough space, although you know - perfectly well that you just released a large chunk of - space! When you try again mere seconds later, the file - creation works as you expect. This has left more than one - user scratching his head and doubting his sanity, the - FreeBSD filesystem, or both. - - If a system should crash after the kernel accepts a - chunk of data for writing to disk, but before that data is - actually written out, data could be lost or corrupted. - This risk is extremely small, but generally manageable. - Use of IDE write caching greatly increases this risk; it - is strongly recommended that you disable IDE write caching - when using softupdates. - - These issues affect all partitions using softupdates. - So, what does this mean for the root partition? - - Vital information on the root partition changes very - rarely. Files such as /kernel and - the contents of /etc only change - during system maintenance, or when users change their - passwords. If the system crashed during the - thirty-second window after such a change is made, it is - possible that data could be lost. This risk is negligible - for most applications, but you should be aware that it - exists. If your system cannot tolerate this much risk, - do not use softupdates on the root filesystem! - - / is traditionally one of the - smallest partitions. By default, FreeBSD puts the - /tmp directory on - /. If you have a busy - /tmp, you might see intermittent - space problems. Symlinking /tmp to - /var/tmp will solve this - problem. - - - How can I add more swap space? @@ -6475,6 +6537,185 @@ C:\="DOS" &prompt.root; vnconfig -e /dev/vn0b /usr/swap0 swap + + + + + System Administration + + + + + Where are the system start-up configuration files? + + + + + From 2.0.5R to 2.2.1R, the primary configuration file is + /etc/sysconfig. All the options are to be + specified in this file and other files such as + /etc/rc (see &man.rc.8;) + and /etc/netstart just include it. + + Look in the /etc/sysconfig file and + change the value to match your system. This file is filled with + comments to show what to put in there. + + In post-2.2.1 and 3.0, /etc/sysconfig + was renamed to a more self-describing &man.rc.conf.5; + file and the syntax cleaned up a bit in the process. + /etc/netstart was also renamed to + /etc/rc.network so that all files could be + copied with a + cp + /usr/src/etc/rc* /etc command. + + And, in 3.1 and later, /etc/rc.conf + has been moved to /etc/defaults/rc.conf. + Do not edit this file! Instead, if there + is any entry in /etc/defaults/rc.conf that + you want to change, you should copy the line into + /etc/rc.conf and change it there. + + For example, if you wish to start named, the DNS server + included with FreeBSD in FreeBSD 3.1 or later, all you need to + do is: + &prompt.root; echo named_enable="YES" >> /etc/rc.conf + + To start up local services in FreeBSD 3.1 or later, place + shell scripts in the /usr/local/etc/rc.d + directory. These shell scripts should be set executable, and + end with a .sh. In FreeBSD 3.0 and earlier releases, you should + edit the /etc/rc.local file. + + The /etc/rc.serial is for serial port + initialization (e.g. locking the port characteristics, and so + on.). + + The /etc/rc.i386 is for Intel-specifics + settings, such as iBCS2 emulation or the PC system console + configuration. + + + + + + How do I add a user easily? + + + + Use the &man.adduser.8; + command. For more complicated usage, the &man.pw.8; + command. + + To remove the user again, use the &man.rmuser.8; + command. Once again, &man.pw.8; will work as + well. + + + + + + Why do I keep getting messages like root: not + found after editing my crontab file? + + + + This is normally caused by editing the system crontab + (/etc/crontab) and then using + &man.crontab.1; to install it: + + &prompt.root; crontab /etc/crontab + + This is not the correct way to do things. The system + crontab has a different format to the per-user crontabs + which &man.crontab.1; updates (the &man.crontab.5; manual + page explains the differences in more detail). + + If this is what you did, the extra crontab is simply a + copy of /etc/crontab in the wrong + format it. Delete it with the command: + + &prompt.root; crontab -r + + Next time, when you edit + /etc/crontab, you should not do + anything to inform &man.cron.8; of the changes, since it + will notice them automatically. + + If you want something to be run once per day, week, or + month, it is probably better to add shell scripts + /usr/local/etc/periodic, and let the + &man.periodic.8; command run from the system cron schedule + it with the other periodic system tasks. + + The actual reason for the error is that the system + crontab has an extra field, specifying which user to run the + command as. In the default system crontab provided with + FreeBSD, this is root for all entries. + When this crontab is used as the root + user's crontab (which is not the + same as the system crontab), &man.cron.8; assumes the string + root is the first word of the command to + execute, but no such command exists. + + + + + + Why do I get the error, you are not in the correct + group to su root when I try to su to root? + + + + This is a security feature. In order to su to + root (or any other account with superuser + privileges), you must be in the wheel + group. If this feature were not there, anybody with an account + on a system who also found out root's + password would be able to gain superuser level access to the + system. With this feature, this is not strictly true; + &man.su.1; will prevent them from even trying to enter the + password if they are not in wheel. + + To allow someone to su to root, simply + put them in the wheel group. + + + + + + I made a mistake in rc.conf, + or another startup file, and + now I cannot edit it because the filesystem is read-only. + What should I do? + + + + When you get the prompt to enter the shell + pathname, simply press ENTER, and run + mount / to re-mount the root filesystem in + read/write mode. You may also need to run mount -a -t + ufs to mount the filesystem where your favourite + editor is defined. If your favourite editor is on a network + filesystem, you will need to either configure the network + manually before you can mount network filesystems, or use an + editor which resides on a local filesystem, such as + &man.ed.1;. + + If you intend to use a full screen editor such + as &man.vi.1; or &man.emacs.1;, you may also need to + run export TERM=cons25 so that these + editors can load the correct data from the &man.termcap.5; + database. + + Once you have performed these steps, you can edit + /etc/rc.conf as you usually would + to fix the syntax error. The error message displayed + immediately after the kernel boot messages should tell you + the number of the line in the file which is at fault. + + @@ -6705,53 +6946,6 @@ C:\="DOS" - - - What is inappropriate about my ccd? - - - - The symptom of this is: - - &prompt.root; ccdconfig -C -ccdconfig: ioctl (CCDIOCSET): /dev/ccd0c: Inappropriate file type or format - - This usually happens when you are trying to concatenate - the c partitions, which default to type - unused. The ccd driver requires the - underlying partition type to be FS_BSDFFS. Edit the disklabel - of the disks you are trying to concatenate and change the types - of partitions to 4.2BSD. - - - - - - Why can I not edit the disklabel on my ccd? - - - - The symptom of this is: - - &prompt.root; disklabel ccd0 -(it prints something sensible here, so let us try to edit it) -&prompt.root; disklabel -e ccd0 -(edit, save, quit) -disklabel: ioctl DIOCWDINFO: No disk label on disk; -use "disklabel -r" to install initial label - - This is because the disklabel returned by ccd is actually - a fake one that is not really on the disk. - You can solve this problem by writing it back explicitly, - as in: - - &prompt.root; disklabel ccd0 > /tmp/disklabel.tmp -&prompt.root; disklabel -Rr ccd0 /tmp/disklabel.tmp -&prompt.root; disklabel -e ccd0 -(this will work now) - - - Does FreeBSD support System V IPC primitives? @@ -7432,184 +7626,6 @@ define(`confDELIVERY_MODE',`deferred')dnl - - - How do I let ordinary users mount floppies, CDROMs and other removable - media? - - - - Ordinary users can be permitted to mount devices. Here is - how: - - - - As root set the sysctl variable - vfs.usermount to - 1. - - &prompt.root; sysctl -w vfs.usermount=1 - - - - As root assign the appropriate - permissions to the block device associated with the - removable media. - - For example, to allow users to mount the first floppy - drive, use: - - &prompt.root; chmod 666 /dev/fd0 - - To allow users in the group - operator to mount the CDROM drive, - use: - - &prompt.root; chgrp operator /dev/cd0c -&prompt.root; chmod 640 /dev/cd0c - - - - Finally, add the line - vfs.usermount=1 to the file - /etc/sysctl.conf so that it is reset - at system boot time. - - - - All users can now mount the floppy - /dev/fd0 onto a directory that they - own: - - &prompt.user; mkdir ~/my-mount-point -&prompt.user; mount -t msdos /dev/fd0 ~/my-mount-point - - Users in group operator can now - mount the CDROM /dev/cd0c onto a - directory that they own: - - &prompt.user; mkdir ~/my-mount-point -&prompt.user; mount -t msdos /dev/cd0c ~/my-mount-point - - Unmounting the device is simple: - - &prompt.user; umount ~/my-mount-point - - Enabling vfs.usermount, however, has - negative security implications. A better way to access MSDOS - formatted media is to use the mtools package in the ports collection. - - - - - - How do I move my system over to my huge new disk? - - - - The best way is to reinstall the OS on the new - disk, then move the user data over. This is highly - recommended if you have been tracking -stable for more - than one release, or have updated a release instead of - installing a new one. You can install booteasy on both - disks with &man.boot0cfg.8;, and dual boot them until - you are happy with the new configuration. Skip the - next paragraph to find out how to move the data after - doing this. - - Should you decide not to do a fresh install, you - need to partition and label the new disk with either - /stand/sysinstall, or &man.fdisk.8; - and &man.disklabel.8;. You should also install booteasy - on both disks with &man.boot0cfg.8;, so that you can - dual boot to the old or new system after the copying - is done. See the - formatting-media article for details on this - process. - - Now you have the new disk set up, and are ready - to move the data. Unfortunately, you cannot just blindly - copy the data. Things like device files (in - /dev), flags, and links tend to - screw that up. You need to use tools that understand - these things, which means &man.dump.8;. - Although it is suggested that you move the data in single user - mode, it is not required. - - You should never use anything but &man.dump.8; and - &man.restore.8; to move the root file system. The - &man.tar.1; command may work - then again, it may not. - You should also use &man.dump.8; and &man.restore.8; - if you are moving a single partition to another empty - partition. The sequence of steps to use dump to move - a partitions data to a new partition is: - - - - newfs the new partition. - - - - mount it on a temporary mount point. - - - - cd to that directory. - - - - dump the old partition, piping output to the - new one. - - - - For example, if you are going to move root to - /dev/ad1s1a, with - /mnt as the temporary mount point, - it is: - - &prompt.root; newfs /dev/ad1s1a -&prompt.root; mount /dev/ad1s1a /mnt -&prompt.root; cd /mnt -&prompt.root; dump 0af - / | restore xf - - - Rearranging your partitions with dump takes a bit more - work. To merge a partition like /var - into its parent, create the new partition large enough - for both, move the parent partition as described above, - then move the child partition into the empty directory - that the first move created: - - &prompt.root; newfs /dev/ad1s1a -&prompt.root; mount /dev/ad1s1a /mnt -&prompt.root; cd /mnt -&prompt.root; dump 0af - / | restore xf - -&prompt.root; cd var -&prompt.root; dump 0af - /var | restore xf - - - To split a directory from its parent, say putting - /var on its own partition when it was not - before, create both partitions, then mount the child partition - on the appropriate directory in the temporary mount point, then - move the old single partition: - - &prompt.root; newfs /dev/ad1s1a -&prompt.root; newfs /dev/ad1s1d -&prompt.root; mount /dev/ad1s1a /mnt -&prompt.root; mkdir /mnt/var -&prompt.root; mount /dev/ad1s1d /mnt/var -&prompt.root; cd /mnt -&prompt.root; dump 0af - / | restore xf - - - You might prefer &man.cpio.1;, &man.pax.1;, - &man.tar.1; to &man.dump.8; for user data. At the time of - this writing, these are known to lose file flag information, - so use them with caution. - - - I tried to update my system to the latest -STABLE, but @@ -7779,16 +7795,6 @@ define(`confDELIVERY_MODE',`deferred')dnl - - - Is there a cryptographic filesystem for &os;? - - - - Yes; see the security/cfs port. - - - How do I change the boot prompt from ??? to