Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Background

I have been rebuilding a small home NAS. This server represents my first 'real' foray into the world of server administration and it has taught me quite a bit already. Originally, the thing was setup using FreeNAS on a thumb drive with 3 magnetic disks configured in a raidz1. I have since resolved to migrate the entire system to FreeBSD 9.0 (STABLE) for greater control of the system as well as to simply learn how to "do it myself". Everything has been going well, with the operating system successfully installed and updated (thumb drive again, rw, with access times and a few other things disabled to prevent flash abuse).

Now I am working on setting up my magnetic disk storage, again using a raidz1. To this end, I have copied all of the files that I want to persist to external storage. While exploring the various zfs commands, I discovered that the original zpool from the FreeNAS installation was still visible. I imported and upgraded the pool using

# zpool import ZFS1 tank   //Import the original zpool 'ZFS1', renaming it 'tank'
# zpool upgrade tank       //FreeNAS uses an older ZFS version, FreeBDS is v28
# zfs mount tank

and was able to view my files again. Gravy. After poking around a bit, I decided that I still wanted to blow away the old pool and start fresh. I issued

# zfs umount tank
# zpool destroy tank

which completed without error. Now I am looking to recreate a 'clean' raidz1 with these disks.

Question

Before I created the new raidz1, I did some poking around in /dev, just to see what I could learn. I wanted to examine the magnetic disks that were used in the array, but the output I got seems odd to me. Worse, googling doesn't really explain what is going on. The disks are listed as follows:

# ls -l ad*
lrwxr-xr-x  1 root  wheel            4 Aug 12 20:50 ad2 -> ada2
lrwxr-xr-x  1 root  wheel            4 Aug 12 20:50 ad4 -> ada0
lrwxr-xr-x  1 root  wheel            4 Aug 12 20:50 ad6 -> ada1
crw-r-----  1 root  operator    0,  96 Aug 12 20:50 ada0
crw-r-----  1 root  operator    0,  98 Aug 12 20:50 ada1
crw-r-----  1 root  operator    0, 100 Aug 12 20:50 ada2

I know that I created three virtual disks in FreeNAS while setting up the raid which is where I suspect the links came from. My questions about this are as follows:

  1. From searching on how symlinks work, it is my understanding that a symlink is just a file that links one item to another. If that is the case, why aren't the ada* devices listed with the 'l' attribute and the actual hardware devices listed with another attribute (perhaps block device)?

  2. These links are an artifact of the previous setup that I do not think are necessary. Can they be deleted? If so, how (kinda afraid to go removing things willy-nilly; see the last link in the references section)? Will deleting the ad* entries implicitly remove the ada* nodes, as they now refer to a link that doesn't exist? Or do I have this backwards?

  3. Which are the actual hardware devices? As I mentioned in my previous question, I would think the ad* nodes would be a character device or something similar and the ada* nodes would be the link files.

  4. Finally, I know that there is definitely be some variance based on setup and individual preferences but what is the 'accepted' way to have my SATA devices configured for a simple raidz1? All of this symlink business seems like overkill for a simple home NAS.

My apologies for the long post, but I have been trying for quite some time to understand this. Thank you in advance for your time and assistance.

References

share|improve this question

migrated from serverfault.com Aug 16 '12 at 18:00

This question came from our site for professional system and network administrators.

1 Answer 1

up vote 2 down vote accepted
  1. ada devices are drives connected to newer SATA ports. Some people missed the memo so DevFS was modified to provide symlinks to these device names as the traditional ad devices. However, the system likely already has some older SATA ports or IDE ports, so those will occupy the lower ad device numbers (ad0, ad1, etc). So the mapped ada deviecs get higher numbers.

    Note: If you haven't realized it yet, /dev is a different type of file system (devfs). While it shows simple constructs like symlinks, they aren't actual symlinks in the sense you're thinking of.

  2. Your premise is wrong, see #1.
  3. The ones that don't say that they're symlinks (via the l as you noted) are device drivers. How "real" they are varies as software can provide a device as well.
  4. I consider the "best" way is to use GPT partitions, give them sensible names, and include those named partitions as vdevs for the raidz.

    Something like the following would do that:

    gpart create -s GPT ada0
    gpart create -s GPT ada1
    gpart create -s GPT ada2
    
    gpart add -t freebsd-zfs -l tank-disk0 ada0
    gpart add -t freebsd-zfs -l tank-disk1 ada1
    gpart add -t freebsd-zfs -l tank-disk2 ada2
    
    zpool create tank raidz /dev/gpt/tank-disk0 /dev/gpt/tank-disk1 /dev/gpt/tank-disk2
    

    Otherwise passing the disks directly to ZFS would be most advised. There are proponents of both configurations. If you go this route I strongly suggest also setting up smartd to monitor disk health. Also configure periodic to scrub the zpool, monitor SMART, and send you periodic reports (weekly or whatever you prefer).

On a side note, FreeNAS and the other FreeBSD derived projects make using FreeBSD a lot easier than simply diving into the core OS. The Handbook will guide you through the vast majority of what you'll want to setup, but you'll run into things over time too. If you Google "handbook", the FreeBSD Handbook is the #2 link; it's that important/popular/good.

One other note about the references. The first one is a poor example as you should not symlink network cards, you should rename them (not a file system type rename though). DevFS does respond to link and unlink requests, mostly as you'd expect. The second and third references seem pretty good. Do keep in mind there's more types of links than symlinks.

share|improve this answer
    
Thanks for the detailed answer. A bit of clarification on your first point: if I am understanding correctly, the symlinks are created by the operating system for compatibility and, for example, ada0 is the drive in the first SATA port which is then linked to ad4 to provide an other style name for the same device? If that is the case, is one better to use than the other when passing in a device node to the zpool command? –  phobos51594 Aug 16 '12 at 18:32
    
Right, you're understanding correctly (though ada0 isn't necessarily port0 on the MB as the MB could have a weird layout, I've seen it enough to know better). Using either device name shouldn't make any difference as ZFS looks for a "marker" on the drives and does not rely on the OS presenting the same device name. –  Chris S Aug 16 '12 at 19:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.