Other Adding new disk renames devices

Hi All,

I have two disks on my system:

Code:
ada0 at ata2 bus 0 scbus0 target 0 lun 0
ada0: <SanDisk SDSSDHP128G X2306RL> ATA8-ACS SATA 3.x device
ada0: Serial Number 133536406390
ada0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 512bytes)
ada0: 122104MB (250069680 512 byte sectors)
ada1 at ata3 bus 0 scbus1 target 0 lun 0
ada1: <WDC WD20EZRX-00D8PB0 80.00A80> ACS-2 ATA SATA 3.x device
ada1: Serial Number WD-WMC4M0750986
ada1: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada1: 1907729MB (3907029168 512 byte sectors)
ada1: quirks=0x1<4K>

My motherboard ( Asrock AD2550-ITX ) only has two SATA slots, so I bought a PCI card, a SIL3114 4 port SATA raid controller, so I could add another disk.

When I put it all together the new disk on the SIL3114 comes up as ada0 and the current disks become ada1 and ada2 which breaks all sorts of things.

Does anyone know a way of making the new disk be ada2?

This is on FreeBSD 11.1-RELEASE

Thanks!
 
Use labels so it doesn't matter what the disk itself is called. Sometimes cards like this have a option so you can boot from them, try turning that off.

This is on FreeBSD 11.1-RELEASE
Make sure to update to 11.2 some time soon, 11.1 has been End-of-Life since September 2018 and is not supported any more.
 
See glabel(8). However do notice, that once you start using a device or partition with one of its names (labels), the others will be hid. Example: if you mount /dev/da0p2, that is also GPT partition named "foo" (/dev/gpt/foo), hosting UFS filesystem named "bar" (/dev/ufs/bar), the latter two names will disappear, until you unmount /dev/da0p2.
 
Hi All,

I have two disks on my system:

Code:
ada0 at ata2 bus 0 scbus0 target 0 lun 0
ada0: <SanDisk SDSSDHP128G X2306RL> ATA8-ACS SATA 3.x device
ada0: Serial Number 133536406390
ada0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 512bytes)
ada0: 122104MB (250069680 512 byte sectors)
ada1 at ata3 bus 0 scbus1 target 0 lun 0
ada1: <WDC WD20EZRX-00D8PB0 80.00A80> ACS-2 ATA SATA 3.x device
ada1: Serial Number WD-WMC4M0750986
ada1: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada1: 1907729MB (3907029168 512 byte sectors)
ada1: quirks=0x1<4K>

My motherboard ( Asrock AD2550-ITX ) only has two SATA slots, so I bought a PCI card, a SIL3114 4 port SATA raid controller, so I could add another disk.

When I put it all together the new disk on the SIL3114 comes up as ada0 and the current disks become ada1 and ada2 which breaks all sorts of things.

Does anyone know a way of making the new disk be ada2?

This is on FreeBSD 11.1-RELEASE

Thanks!

Go into your BIOS and look around for a feature that descibes how PCI devices are enumerated, and change it to "onboard first" (if that's an option), or swap the direction of enumeration (ascending / descending).

That way, onboard controllers will be enumerated first, and disks attached to those controllers will be listed first.

Alternatively, the "better" way, is to use labels instead of raw device names. Either label the partitions (via gpart(8) if using GPT), or label the drives (via glabel(8) if using MBR), or label the filesystems (via tunefs(8) if using UFS). That way, regardless of what the actual device node is, you'll always use the correct device. :)

GPT labels will appear under /dev/gpt/, glabels will appear under /dev/label/, and UFS labels will appear under /dev/ufs/. You can use those the same as you would use the raw /dev/ada0p2 devices.
 
Sorry to hijack the thread but I decided to add my existing labels to my /etc/fstab, however...none of the GPT directories you mentioned under /dev exist on my 12.0-RELEASE system. Maybe I don't actually have labels? I get the label (name?) output when I run gpart show -l:

Code:
/home/paul paul@whiteforest% gpart show -l
=>       40  488397088  ada0  GPT  (233G)
         40     409600     1  (null)  (200M)
     409640    2097152     2  (null)  (1.0G)
    2506792  104857600     3  wfrootfs  (50G)
  107364392  104857600     4  wfvarfs  (50G)
  212221992  276175136     5  wfusrfs  (132G)

=>        40  1000215136  ada1  GPT  (477G)
          40  1000215136     1  wfhomefs  (477G)
 
That's what I mentioned earlier: there is no such directory on my system. I made the labels using the installer when I did the original install. Are those not labels then?
 
Ok, as far as I remember I have always used the installer and specified the labels. They always have been in place afterwards. This is why I posted without reading the posts above. I am still running FreeBSD-11.2 RELEASE but I doubt that FreeBSD-12.0 RELEASE would behave different in such a basic case. This is strange.
 
Hi Sevendogsbsd.
You can check your labels with gpart list. But as Bobi B. stated above, if you have start using a partition with one of its name (diskid, gptid, gpt label or glabel) the kernel picks up that name to use and the rest are hidden from view.
That may explain why you have no dedicated device note directories. But Im not sure.
 
So I ran gpart list and I do actually have labels for all partitions with the exception of the EFI partition and swap. I do not however have a directory named /dev/gpt. I do have a /dev/gptid with a single uuid in it but that's not what we are looking for.

It's a mystery...

Not a deal breaker but I would like to have labels referenced instead of device names. Off to read the man pages :)
 
So, tunefs -L <label> <device> while booting to the install USB and shelling out had no effect. The labels remain as they were when running gpart list but no /dev/gpt or /dev/ufs directories exist. Head scratcher...

Output of gpart list:

Code:
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 488397127
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: ada0p1
   Mediasize: 209715200 (200M)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,GPT,3e828834-0605-11e9-af5a-309c2324ce0d,0x28,0x64000)
   rawuuid: 3e828834-0605-11e9-af5a-309c2324ce0d
   rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
   label: (null)
   length: 209715200
   offset: 20480
   type: efi
   index: 1
   end: 409639
   start: 40
2. Name: ada0p2
   Mediasize: 1073741824 (1.0G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
   efimedia: HD(2,GPT,469a1dab-0605-11e9-af5a-309c2324ce0d,0x64028,0x200000)
   rawuuid: 469a1dab-0605-11e9-af5a-309c2324ce0d
   rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
   label: (null)
   length: 1073741824
   offset: 209735680
   type: freebsd-swap
   index: 2
   end: 2506791
   start: 409640
3. Name: ada0p3
   Mediasize: 53687091200 (50G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(3,GPT,5f744324-0605-11e9-af5a-309c2324ce0d,0x264028,0x6400000)
   rawuuid: 5f744324-0605-11e9-af5a-309c2324ce0d
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: wfrootfs
   length: 53687091200
   offset: 1283477504
   type: freebsd-ufs
   index: 3
   end: 107364391
   start: 2506792
4. Name: ada0p4
   Mediasize: 53687091200 (50G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(4,GPT,6c98341e-0605-11e9-af5a-309c2324ce0d,0x6664028,0x6400000)
   rawuuid: 6c98341e-0605-11e9-af5a-309c2324ce0d
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: wfvarfs
   length: 53687091200
   offset: 54970568704
   type: freebsd-ufs
   index: 4
   end: 212221991
   start: 107364392
5. Name: ada0p5
   Mediasize: 141401669632 (132G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(5,GPT,7a781ff1-0605-11e9-af5a-309c2324ce0d,0xca64028,0x10761920)
   rawuuid: 7a781ff1-0605-11e9-af5a-309c2324ce0d
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: wfusrfs
   length: 141401669632
   offset: 108657659904
   type: freebsd-ufs
   index: 5
   end: 488397127
   start: 212221992
Consumers:
1. Name: ada0
   Mediasize: 250059350016 (233G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r4w4e7

Geom name: ada1
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 1000215175
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: ada1p1
   Mediasize: 512110149632 (477G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(1,GPT,9654ce9c-0605-11e9-af5a-309c2324ce0d,0x28,0x3b9e1260)
   rawuuid: 9654ce9c-0605-11e9-af5a-309c2324ce0d
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: wfhomefs
   length: 512110149632
   offset: 20480
   type: freebsd-ufs
   index: 1
   end: 1000215175
   start: 40
Consumers:
1. Name: ada1
   Mediasize: 512110190592 (477G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
 
Dear Sevendogsbsd,
this is worse than a shot in the dark, but ... is devd running on your system? It should run as default and I am not sure if it would cause a situation as yours when it does not run. If not please ignore this post... Or some none-default unwanted stuff in /etc/devd.conf. Please correct me if this cannot be a root cause. It is really a head scratcher, but interesting because it usually just works.
 
Hi Sevendogsbsd
as mentioned above the kernel picks up the first name he recongnizes (e.g. physical disk partitions such as ada0p1) and all other labels will disappear in /dev and thus you may have no specific device node directory for gpt or diskid or whatever. Nevertheless you can add labels in retrospect and they will be recognized by gpart list or glabel list.
The question is what kind of labels did you use, gpt or glabel or did you use ufs labels? And did you create them with the gpt schemes or afterwards or did you modified them?
 
You could unmount a specific partition (or better FS), change labels and then mount them with another device node, e.g. with GPT labels.
 
Chrbr - yes, I show /etc/rc.d/devd listed when I run service -e

Lanakus - I created the labels using the installer originally, then re-did them a couple of hours ago using the command I listed in an earlier post: tunefs -L <label> <device>. I did this while booted to the install thumb drive so the file systems would not be mounted.

Both my disks are GPT, file systems are all UFS, with the exception of the EFI partition, which is FAT32.

Interestingly, when I run glabel list, I only get the 2 FS that I did not assign labels to: my EFI partition and my swap partition. When I run gpart list, I get the full output I showed in an earlier post.
 
To me the whole label situation is a bit confusing.
On the glabel(8) manual page you can see that glabel is involved with disk labeling, partition labeling and diskid/gptid labels.
glabel also starts automatically and I have had a hard time removing whole disk labels as well.
I got so frustrated with it I used the hard linking in device.hints to get what I wanted.
This is only appropriate for whole devices, not partitions..
https://dan.langille.org/2016/03/02/adding-in-a-sas-card-renumbered-my-devices/
 
I assume then that these instructions Labeling were not appropriate for my set up?
Jap, think this refers to initial system setup.

I suspect its for an unrisky desktop system right? Im not certain whether it work but you can try to disable other labels than GPT explicitly in /boot/loader.conf
Code:
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"

After a reboot you should end up with kern.geom.label.gpt.enable: 1.
Maybe you should disable also ufs labels if you created them.
 
I'd first like to advice the strict use of GPT label only on GPT capable systems, to avoid
exactly those headaches, don't use glabel or tunefs -L on modern systems.

Stick to gpart [add|modify] -l [I]label[/I] ....
It will let you label all partitions types, no matter if freebsd-boot, efi, freebsd-swap, freebsd-ufs or freebsd-zfs.
You can use those labels in /etc/fstab, like...
Code:
/dev/gpt/san480-rootfs  /       ufs     rw,noatime 1    1
/dev/gpt/san480-swap    none    swap    sw         0    0
and, even better, as device names for zfs like...
Code:
zpool status
  pool: storage
 state: ONLINE
  scan: scrub repaired 0 in 1h5m with 0 errors on Thu Jan 17 18:14:54 2019
config:

        NAME          STATE     READ WRITE CKSUM
        storage                   ONLINE       0     0     0
          mirror-0                ONLINE       0     0     0
            gpt/top                ONLINE       0     0     0
            gpt/2nd-from-top     ONLINE       0     0     0
          mirror-1                ONLINE       0     0     0
            gpt/3rd-from-top       ONLINE       0     0     0
            gpt/bottom            ONLINE       0     0     0

errors: No known data errors
This way you can easily identify and add/remove/move around your disks.

In addition, to save even more headache, I can recommend to disable all unused id types in /boot/loader.conf (not necessary though)
Code:
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=0
kern.geom.label.ufsid.enable=0
This will also make the output from gpart show (-l) less cluttered, as unmounted disk won't appear twice.


TUTORIAL ON THE WAY.
I have just started to write a tutorial on this, which I'm going to post tommorow.
Including examples why e.g./dev/gtp/... does not apear when a partions is labeled using gpart.
 
Jap, think this refers to initial system setup.

I suspect its for an unrisky desktop system right? Im not certain whether it work but you can try to disable other labels than GPT explicitly in /boot/loader.conf
Code:
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"

After a reboot you should end up with kern.geom.label.gpt.enable: 1.
Maybe you should disable also ufs labels if you created them.

Yes, unrisky desktop - looks like k.jacker may have hit this on the head: I have a brand new system (< 1 year old homebuilt) and used tunefs to label. I am going to reboot into single user mode and use gpart to modify the labels to see how that goes.
 
Back
Top