Boot problem after adding old hard disk to the system

I have made a fresh install of FreeBSD 9. Everythig worked fine. Then I decided to add an old drive on which I have some data and this caused the system to ask me for mountroot>.

In my /etc/fstab is following:
Code:
/dev/ada0p2	/		ufs	rw	1	1
/dev/ada0p3	none		swap	sw	0	0

If I unplug the extra hard disk the system boots normally.

I have seen during boot process that the added drive becomes ada0 and the boot one ada1. Why is this happening? On my previous setup with FreeBSD 8 I had no such issue while adding an additional drive to the system.
 
Tried it but it doesn't work. I have followed the tutorial but after the first reboot the labels are gone.

What am I missing here?
 
If you add the labels and let it mount the filesystems, it will wipe out the labels. So boot single-user, set the labels with tunefs(8), then reboot (not ctrl-d or exit). Actually, it might work to force a retaste, but I haven't tested that.
 
I did it exactly as the tutorial says:
  • boot in single-mode
  • set the labels
  • didn't mount volumes
  • reboot (shutdown -r now)
  • check for labels - no labels found
 
The only thing that occurs to me is possibly duplicate labels on the two disks. What type of labels did you use, and where did you look for them?
 
atomant said:
I have seen during boot process that the added drive becomes ada0 and the boot one ada1. Why is this happening? On my previous setup with FreeBSD 8 I had no such issue while adding an additional drive to the system.
As others have mentioned, labels are the best way to deal with this.

However, you might be able to work around it in hardware. If both drives are the same type and speed (for example, 3GB/sec SATA) you could try swapping the cables on your motherboard / controller ports.

FreeBSD probes for drives in a predicable order and will generally number them starting at 0. If you add a drive on a port that is probed before your existing ada0, the new drive will become ada0 and your existing drive will move to ada1. Some motherboards don't clearly label the ports or do strange things with them - for example, I have a system where the port order is different in AHCI mode vs. legacy mode.

Of course, swapping the cables is only useful if both ports offer the same functionality. You might have a good reason for connecting them as you did - for example, if you connected your system disk to an add-in controller with enhanced functionality.

Was your previous FreeBSD 8 install on the same system? I'm not sure why the order would change on a newer version.
 
wblock@ said:
The only thing that occurs to me is possibly duplicate labels on the two disks. What type of labels did you use, and where did you look for them?

I had only one disk plugged in and running just to avoid what you have said.
 
Just another thing. Can I use tunefs even if my disk is GPT or should I use gpart?

At the beginning of the install process I have configured partitions and also wrote labels for them but it looks like the setup didn't take care of this option.
 
wblock@ said:
Could you show the output of file(1) and tunefs(8) on those filesystems?
# file -s /dev/ada0p2
# tunefs -p /dev/ada0p2

Code:
server# file -s /dev/ada0p2
/dev/ada0p2: Unix Fast File system [v2] (little-endian) last mounted on /, last written at Mon May 21 20:35:43 2012, clean flag 0, readonly flag 1, number of blocks 13107200, number of data blocks 12898855, number of cylinder groups 70, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 80, pending inodes to free 1, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization

server# tunefs -p /dev/ada0p2
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       enabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)
 
In single-user mode, without remounting so / is still readonly, do
# fsck -y /dev/ada0p2
# tunefs -L zootfs /dev/ada0p2
# reboot

After it reboots, that label should be in /dev/ufs/. There are two differences there. The output from file(1) made me think fsck(8) needed to be run ("pending" numbers), and tunefs(8) shows SUJ, which I'm not using but should not matter for labels.
 
I have done like you said but after reboot:

Code:
server# ls /dev/ufs
ls: /dev/ufs: No such file or directory
 
Looks like the label is there:

Code:
server# tunefs -p /dev/ada0p2
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       enabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 rootfs

But where it is hiding?
 
When a device is mounted, some or all of the device names and labels pointing to it are hidden. When all the labels in /dev/ufs are hidden, that directory goes away. Change /etc/fstab to use the label now, and it will work.

Note: "zootfs" was not a typo. Give each filesystem a unique name to avoid collisions when two filesystems have the same name. "bobrootfs", "xrootfs", and so on.
 
Back
Top