# How to get /dev/disk ?



## xibo (Aug 13, 2011)

Hello

I've seen hard disks being referenced by their IDs, i.e. /dev/disk/by-id/something in some threats (example) as well as the mail archives, which is IMO quite useful - partition labels do the job elsewhere but I read recommendations everywhere to use whole disks for zpool-vdevs.

My problem is, that I don't even have the /dev/disk directory to begin with. I guess it's a kernel module or config option that needs to be loaded/set (since zfsboot eventually can't access /etc/devd.conf when booting to zfs-root backed by disk-id vdevs), but I don't know which one...

... can anyone tell me?


----------



## Beastie (Aug 13, 2011)

I'm not on FreeBSD right now so I might be wrong but I don't think there's a /dev/disk directory. Those UFS partition IDs are somewhere else. Do a *ls* on /dev and *cd* to the different directories.


----------



## nekoexmachina (Aug 13, 2011)

*xibo*, you have choice of two:
1) gpt-naming (you need to have GPT on your hdd)
Naming is '-l' option in gpart(8), and nodes will be located in /dev/gpt
2) ufs-naming (obviously you need to have ufs filesystem to do that)
you need -L option in tunefs(8).
The /dev/disk/by-* thing is linux-only (e.g. in thread you've linked to guy probably has created his zpool on Linux)
Also may be there will be something else, which Im not aware of.


----------



## xibo (Aug 13, 2011)

UFS filesystem labels end up in /dev/ufs/something.

If it's a linux based (udev?) thing, is everyone using the probe-sequence based device identifiers (ad0, ad1, ...) for zfs, or are there some tricks?
Also, does ZFS scan the UUIDs or something alike of whole disks when adding them to a zpool, or will it reference the device identifiers directly (i.e. not be movable to another hardware disk controller)?


----------



## rusty (Aug 13, 2011)

xibo said:
			
		

> Also, does ZFS scan the UUIDs or something alike of whole disks when adding them to a zpool, or will it reference the device identifiers directly (i.e. not be movable to another hardware disk controller)?



ZFS uses a bunch of data that can be viewed with 


```
root@openindiana:~# zdb -l /dev/rdsk/c4t0d0s0
--------------------------------------------
LABEL 0
--------------------------------------------
    version: 28
    name: 'rpool'
    state: 0
    txg: 54715
    pool_guid: 11493968878917956519
    hostid: 440627
    hostname: ''
    top_guid: 16793397187076719816
    guid: 16793397187076719816
    vdev_children: 1
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 16793397187076719816
        path: '/dev/dsk/c4t0d0s0'
        devid: 'id1,sd@SATA_____WDC_WD2502ABYS-0_____WD-WCAT1E437770/a'
        phys_path: '/pci@0,0/pci1043,8443@11/disk@0,0:a'
        whole_disk: 0
        metaslab_array: 30
        metaslab_shift: 31
        ashift: 9
        asize: 251014152192
        is_log: 0
        create_txg: 4
<snip>
```


----------

