# da0 -> da1



## balanga (Apr 2, 2021)

I'm booting from Grub2 and loading FreeBSD via this menuentry:-

```
menuentry "FreeBSD 12.2-RELEASE amd64 ***** STABLE default - use for XWindows ******  !" {
    insmod ufs2
    insmod part_gpt
    set root=(hd0,4)
    kfreebsd /boot/loader
}
```

Here I specify (hd0,4) to load FreeBSD although I also have a second USB disk. Now when FreeBSD boots da0 is assigned to the second disk and the FreeBSD disk is da1. How do I know which device ID FreeBSD will assign to which disk?


----------



## DutchDaemon (Apr 2, 2021)

sysutils/ethname has really saved me from many headaches.

It's lovely being able to do this:
	
	



```
ethname_enable="YES"
ethname_vlan0070_mac="00:50:56:88:e1:24"
ifconfig_vlan0070="inet 172.16.12.44 netmask 255.255.255.0"
```

And then see:
	
	



```
# ifconfig vlan0070
vlan0070: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=e403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether 00:50:56:88:e1:24
        inet 172.16.12.44 netmask 0xffffff00 broadcast 172.16.12.255
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```


----------



## T-Daemon (Apr 2, 2021)

balanga said:


> Here I specify (hd0,4) to load FreeBSD although I also have a second USB disk. Now when FreeBSD boots da0 is assigned to the second disk and the FreeBSD disk is da1. How do I know which device ID FreeBSD will assign to which disk?



FreeBSD isn't here to focus on to but GRUB2. Instead of setting in the `set root` variable disk nr/partition better set an UUID. Changing disk device names won't be an issue then.

The following guide will provide a working example of an menu entry:

Have all disks plugged in (internal, external)
Boot a Linux live installation image or multi OS/Linux
Run `sudo blkid` , take note of the UUID's
Edit /boot/grub/grub.cfg (or 40_custom, run update-grub afterwards):


```
menuentry "FreeBSD" {
    set root_uuid=xxxxxxxxxxxxxxxx
    search --fs-uuid $root_uuid --set=root
    kfreebsd /boot/loader
}
```
 
`root_uuid` must be the partition where the FreeBSD loader is located.


----------



## balanga (Apr 3, 2021)

The problem I'm thinking about is having a script on one disk which wants to perform an action on the other disk. If I want to`gpart add .... daX` and the script is on daY, how do I tell that which is da0 and which is da1?


----------

