# boot problem when adding disks



## spoom (Jan 23, 2012)

I switch from win7 to freebsd FreeBSD 9 from mb. I disable unnecessary disks and then boot to on or the other system. But I need to access an NTFS disk, so I turn on the disk (install) on mb. Now, I have to go through complicated gymnastics to boot to fbsd since the /dev listing changes when I add the HDD. eg. /etc/fstab shows ada0p2 to boot but when there is a new disk, the boot disk may be ada1p2. And if I add a second disk, I'm looking to join the Cirque de Soleil.  :\ 

Anyway, I don't understand the change from ad0s1, s1a, ss1b, etc to the current linking system. Is has it something to do with new file systems. I just installed the plain vanilla generic stuff and it works fine, but add a disk and it all falls apart.

What do I need to do to be able to add or change disks, use external USB3 docks? And then, how to configure that?

BTW, my motherboard is Asus Maximus IV extreme with i7-2500K at 4600hz. I don't know if that has anything to do with the problem.

TIA


----------



## bbzz (Jan 23, 2012)

That's why it's a good idea to label disks so that they are recognized by label and not influenced by the disk boot order.

glabel(8)


----------



## wblock@ (Jan 23, 2012)

Putting a label on a disk is difficult to do after partitions and filesystems already exist.  But filesystem labels are automatic.  If the NTFS filesystem has a name, it may already be showing up in /dev/ntfs/.  And FreeBSD UFS filesystems can be named with tunefs(8) -L in single user mode.  Those will appear in /dev/ufs/.


----------



## spoom (Jan 23, 2012)

Thanks guys, I didn't know dev was automated. How does the labeling affect such disks as ntfs and, in particular, the win7 boot disk (ntfs, of course)? But what would be the best way to set up the computer to be able to alternate between the OSs and be able to turn on/off some disks. I don't want to have the burn out uselessly. Or would it be better to use a docking station to switch the disks (esata or usb3, how would they work on FBSD FreeBSD 9).

Hope I'm not asking too much. :e


----------



## wblock@ (Jan 23, 2012)

Filesystem labels are automatic.  The NTFS label is what you see in windows as the drive name.  On FreeBSD, all you have to do is assign the labels (see FreeBSD Labeled Filesystems) and edit /etc/fstab to use them.

Shutting off drives would have to be done by the running operating system.  External drives might be easier.


----------



## spoom (Jan 24, 2012)

Thanks wblock,
I already did that and fbsd9 FreeBSD 9 works fine and the ntfs disk mounts ok too. But what is the new system or disk/partition labeling - before, *df* would show the disk as eg. ad12s1a, ad12s1f, etc. Now, I see in /dev that the disks have the same designation - ad12 but also there are links to the disks as ad12p1, ad12p2, ad12p3; some have 3 p links, some just 2. Where could I get an explanation of these changes?


----------



## wblock@ (Jan 24, 2012)

Those aren't labels, just disk and partition device names.  Traditional MBR format uses "s" for slice and a letter for the traditional bsdlabel(8).  So ad0s1a is slice 1, "partition" "a".

The newer GPT format is simpler, just "p" for partition.  And there can be more than four of those partitions, so there's not much reason to use bsdlabel any more, just put each filesystem on its own GPT partition.

GPT labels or filesystem labels make things even simpler.  Once one of those labels is assigned to a partition or filesystem, it stays the same.  So after naming ada0p2 on my Acer D250 to drootfs with gpart(8), /dev/gpt/drootfs appears whenever that drive is connected, and regardless of whether it's a SATA cable or USB.  Use those in /etc/fstab and which drives are connected to what controllers doesn't matter any more.


----------



## spoom (Jan 25, 2012)

Sorry, but that does not work or I am missing something. First, just labeling the the freebsdl-boot partition is not enough. I change ada2p2 to rootfs and fstab to /dev/gpt/rootfs but that does not work; I still have to enter ufs:/dev/ada2p2 to boot. Changing the label of ada2p3 to a label also does not help. I must be missing something here or FreeBSD is missing something. It took me a while to fish through the man pages to get nowhere.


----------



## varda (Jan 28, 2012)

You can use automatic ufsid or (since you have used GPT partitioning) gptid labels. Example

```
# glabel status
                                      Name  Status  Components
gptid/62c1175a-3ead-11e1-b67f-001fd0a57883     N/A  ada0p1
gptid/b12688d5-3eae-11e1-b67f-001fd0a57883     N/A  ada0p2
gptid/dd7c9aab-3eae-11e1-b67f-001fd0a57883     N/A  ada0p3
                    ufsid/4f117b1afa12b3c7     N/A  ada0p4
gptid/de5b3333-3eae-11e1-b67f-001fd0a57883     N/A  ada0p4
                    ufsid/4f117b1d12e44029     N/A  ada0p5
gptid/ded97bfd-3eae-11e1-b67f-001fd0a57883     N/A  ada0p5
```
Determine what filesistems on which partition and create fstab by adding correspondig ufsid or gptid. Example:

```
# Device						Mountpoint	FStype	Options	Dump	Pass#
/dev/gptid/dd7c9aab-3eae-11e1-b67f-001fd0a57883		/		ufs	rw	1	1
/dev/gptid/b12688d5-3eae-11e1-b67f-001fd0a57883		none		swap	sw	0	0
```
If you have difficulties determining partitions then boot from live cd or another OS installation on other HDD in order to make sure that your targeted partitions are not in use.

Also you can obtain type of partition an gptid's with command:

```
gpart list
```


----------



## wblock@ (Jan 28, 2012)

spoom said:
			
		

> Sorry, but that does not work or I am missing something. First, just labeling the the freebsdl-boot partition is not enough.



freebsd-boot is a partition for the boot loader.  It doesn't need a label, it's only for booting.  It will load the kernel from the next freebsd-ufs partition after it.



> I change ada2p2 to rootfs and fstab to /dev/gpt/rootfs but that does not work; I still have to enter ufs:/dev/ada2p2 to boot. Changing the label of ada2p3 to a label also does not help.



Please show the output of
`% gpart show -l ada2`


----------

