MikeL's FreeBSD howto - disk notes

(Last update: 17-Feb-2014)

DELL PowerEdge Perc BIOS:
I'm noting this here as when I went through this I went through a lot of internet searching trying to find out if it's really ass easy as all this...

I have a (now ancient) Dell 2450 with SCSI U320 disks. I'm running FreeBSD, no RAID monitoring software. Drive 1 on the the RAID array was showing a yellow flashing light instead of green activity light. The front panel indicated a failed drive 1, I've forgotten the exact error code now.

To make a long story short, without even shutting down, I simply pulled the old drive, unscrewed it from it's caddy, screwed a replacement drive into the caddy, and slipped it into the slot. The green LED came on, and after a while settled down to a steady flashing (not the irregular activity light) that I presume means it's formatting/copying data whatever. After about 45 mins I had to leave, so do not know if the light has eventually settled down to normal activity or what.

Please note that although the existing drives are all 15kRPM, the only replacement drive I was able to find in a hurry was a 10k RPM. This does not seem to have caused any problems - I have no accurate mechanism to check for before and after performance.


Additionally I have a not-quite-as-ancient Dell PowerEdge 2950 with up to 8, modern "laptop" 2.5 inch drives. I have not tried hot-plug on this machine, but do wish to mention the setup. It already had drives in it configured as first BIOS drive (FreeBSD system is on this).

I just installed 3x 750GB drives for customer data. I shutdown and powerdown, slipped the drives in, and powered up. Hit ctrl-R at boot screen. The Perc screen is really, really hard to figure out, the important thing to know is you must go into "tree view", select each drive which assigns it a number. Then use F12 (F2?) to go into options on the VD screen, create a new VD, it'll choose all the new drives, Ok it. (Sorry for the vague description it took a while to stumble through it and I don't remember the exact details any more.) It seems to have been smart enough to start "initializing" on its own. At the VD screen it' ll show a progess bar. It took overnight, about 18 hours to finish on my RAID 5 3x 750GB setup. I do not know if this would take care of itself if I had let the system reboot or not, I left and came back later.

Then booted FreeBSD, and followed my directions below for a new data-only disk, and everything seems fine.

Adding a new hard drive:
(Note! These directions seem to be out of date in FreeBSD 3.3 -- you may want to continue on to the second part.)

  1. Follow the directions in the FreeBSD Handbook, in section 8 "Disks", "Using Sysinstall":
  2. Peruse the man page for 'fstab', then add the new disk there (assuming you want it brought online automatically at boot time).
  3. At this point, everything is ready to go, but it's not actually online. You still have to do that manually. This is not a DOS machine, you do not need to reboot -- merely use the 'mount' command to bring it online. You can either specify the particular new entry by pathname, eg 'mount /drv2', or you can have it mount all the drives eg 'mount -a'. In the latter case, ignore the errors from all the other already mounted drives -- they are benign.
Note that when installing a data-only disk (in FreeBSD 3.3), especially if it had old junk on it, you must start by going through the 'fdisk'.
  1. As root /stand/sysinstall.
  2. Use up and down arrows to select configure, then fdisk.
  3. Move to the proper disk with up and down arrows, then hit the space bar to select it.
  4. Now that you're in fdisk, check the top left of the screen -- be sure that "Disk Name: dax (or wdx is the right one.
  5. Use up and down arrows to move around the lower entries in the screen. In each one that is not marked "unused", hit 'd' to delete this partition. Do this until they're all gone except for a single "unused".
  6. Hit 'a' to use entire disk. Hit 'yes' if you do want to maintain compatibility. There's no real reason not to.
  7. Do not hit 'w' to write changes here, we'll do that later.
  8. Now use up and down arrows to select "standard" ie. no boot manager. This does not affect your existing boot sequence, this is simply asking if you want this disk to have a boot manager. As we're installing a data-only disk, there's no need. If you may someday plan to set this disk up as a bootable system disk, you can, but in this case we're doing a data-only disk.However, we must clobber any old junk left there from previous uses -- we cannot take the "untouched" option, this will not work. Use up and down arrows to move to 'standard', then hit the space bar, then enter.
  9. Now take the partition option in sysinstall. As above, be sure to select the right disk. Once in, check the top left of the screen to make sure you got the one you intended.
  10. Hit 'c' to create a new partition. I would recommend that you have several swap disks on your system -- if you don't already have multiple swap disks, and can afford to use some disk space, do so here -- it'll be a performance boost. Depending on how many swap partitions you'll have, and how much memory you system has, and how many large apps you'll be running you may choose different values. I just try to spread about 1gig across as many disks as I expect to have in the computer. Wipe out the number there, then enter whatever (perhaps 256m), hit enter, down arrow to "swap", hit Enter. If possible though, you may want to have one disk with no swap file so that you can more easily physically swap a different disk in in it's place.
  11. Hit 'c' again, then just hit Enter to use the rest of the disk. Hit Enter to make it a file system, then give it a mount point (the directory where this disk should appear). Something boring like "/dsk2" is just fine, you can change this later by modifying /etc/fstab.
  12. Hit 'w' to write changes, then Enter if you have faith in what you've just done. It will leave the partition editor, and pause for as much as a few minutes while it does a 'newfs' (similar to DOS "format" if you're a DOS user).
  13. At a command line you may have to use newfs.
    The sysinstall generated command for a DOS compatible, entire disk partition seems to be newfs -b 8192 -f 1024 /dev/rdaxs1e.
  14. You may have to manually edit /etc/fstab.

Replacing an existing disk with a new blank one
If you're lucky enough to have a spare IDE slot, just go through the adding a new drive (above), then move the dir structure onto the new larger drive, and remove the old smaller drive. For this reason it's a good idea to upgrade a drive as opposed to filling the last IDE slot.

A generic Unix hint: when moving an entire directory tree, don't use 'cp'. This has some annoying side-effects like not preserving permissions (or some such, I can't even remember the exact reason any more -- maybe it was related to links). Instead, use one of the more powerful file handling tools, 'cpio', 'tar', 'pax', etc.
I use (a single line, even though your browser may break it in two):
  tar --create --preserve-permissions --one-file-system --sparse -f - /src-dir | tar --directory /dst-dir --extract --preserve-permissions --sparse -v -f -
Note that the path given in src-dir will be prepended in dst-dir, e.g.
  src-dir=/web/somebody.com
  dst-dir=/dsk40gig/web2/
will end up in a new target of:
  /dsk40gig/web2/web/somebody.com/


Moving a SCSI disk from one FreeBSD to another
This is not as trivial an excercise as it sounds.

Replacing an old (presumedly smaller drive) with a live disk
Bear in mind that your PC's BIOS may take the liberty of remapping your SCSI drives into the sytem. FreeBSD may not know anything about which actual drive is in which LUN. In other words, just because you don't have a SCSI LUN conflict on the target system, doesn't mean the old drives will appear where you expect. Be sure you use a LUN that matches the old drive you pulled out, eg. if you had LUNs 0, 2, and 5 in use, and are replacing LUN 2, simply adding one at LUN 6 will probably barf. Adding it at 2, 3, or 4 will probably be ok, but better just make it match.

Before starting, be sure to edit your /etc/fstab and remove the mount of the drive you're about to change out. This way if there is any problem, you will still be able to boot the system, 'though missing this one drive.
Most importantly, be sure that you comment out any swap partition that may have been on that disk if the new disk doesn't have one. You could mangle data this way.


Mounting the CDROM
Shortcut for mounting a CD-ROM: add an entry to /etc/fstab like this:
     /dev/wcd0c       /cdrom    cd9660  ro,noauto       0       0
Thenceafter, you can mount your cdrom with:
          mount /cdrom
(This neat trick courtesy of The FreeBSD Diary)

Mounting the floppy
Go to The FreeBSD Diary

Copyright © 1995-2017 Mike Lempriere