Solved Device busy...

What does mount show? Is ada1 mounted?

And what have you got in /etc/fstab at the moment (don’t change anything in it!)

When I do cat /etc/fstab
I get this:
# Device Mountpoint FStype Options Dump Pass#
/dev/ada2b / ufs rw 1 1
/dev/ada1b none swap sw 0 0
# Added by auto-admin from /usr/local/sbin/auto-add-fdesc-mount
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
# linprocfs /compat/linux/proc linprocfs rw 0 0
# tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0
# linsysfs /compat/linux/sys linsysfs rw 0 0
# End auto-admin addition


I have since changed the two /dev lines to
/dev/ada2p2...
/dev/ada2p3....

Then rebooted, and everything works just fine.

After that, I was able to delete ada1b

Ken Gordon
 
The command, as root, as given: gpart show -p
And the result:

=> 63 312579632 ada3 MBR (149G)
63 312560577 ada3s1 ntfs [active] (149G)
312560640 19055 - free - (9.3M)

An MBR disk with 1 ntfs slice. Old Win7
I'm omitting the repeats with labels.

=> 63 976770992 ada0 MBR (466G)
63 975693957 ada0s1 ntfs [active] (465G)
975694020 1852 - free - (926K)
975695872 1071104 ada0s2 !39 (523M)
976766976 4079 - free - (2.0M)

An MBR disk with 2 slices, 1 ntfs. The second may be a Windows repair / recovery slice/partition (!39). Win10.

=> 0 3907029168 ada1 BSD (1.8T)
0 3898605568 ada1a freebsd-ufs (1.8T)
3898605568 8388608 ada1b freebsd-swap (4.0G)
3906994176 34992 - free - (17M)

This is (now WAS?) the problem child. BSD scheme but not within either an MBR (4 slices) or GPT (many partitions) framework. Known as "dangerously dedicated" mode, in that other OSes, esp. Windows, will see it as unused space, available to clobber.

So, no ada1s1a or ada1p1a, just ada1a and ada1b. This is why I asked for gpart's -p switch, to show full partition names rather than just the numerical indices.

Double-check gpart(8) re encapsulating BSD scheme partitions within MBR slices or GPT partitions. The latter is rarely used, but possible.

=> 40 3907029088 ada2 GPT (1.8T)
40 1024 ada2p1 freebsd-boot (512K)
1064 3898604536 ada2p2 freebsd-ufs (1.8T)
3898605600 8388608 ada2p3 freebsd-swap (4.0G)
3906994208 34920 - free - (17M)

Ok. I'd have made a lot more swap on such a large drive, though putting swap on SSD may make more sense.

As you can see, I have 4 HDDs in this computer: the 160 GB drive is my old WinXP, the 500 GB drive is my present Win10 installation.
When I do cat /etc/fstab

# Device Mountpoint FStype Options Dump Pass#
/dev/ada2b / ufs rw 1 1
/dev/ada1b none swap sw 0 0

ada2b doesn't exist. swap is now ada2p3.

# Added by auto-admin from /usr/local/sbin/auto-add-fdesc-mount

I'm ignoring those ...

The problem entry, as I see it is:
/dev/ada1b

As you can see from the output of gpart show -p, ada1 is the DISK-9VMV4Y01, but if I change that line to dev/ada2c, which should be the swap partition on ada2, the system returns that it can't find it.

No, under BSD scheme, swap is always the 'b' partition. 'c' denotes the whole 'disk' and you won't see it in fstab. As above, swap is ada2p3 (GPT).

So you should redo ata1 as GPT to match ata2, if that's what you wanted.

So, either the naming of the drives as far as the system is concerned does not mean the same as the naming of the drives under gpart show, or the system is actually using ada1 as its swap drive.

Just use % mount to see what the system thinks.
[edit:] or mount -p to see mounts in fstab format.

Now, if I change these two lines from
/dev/ada2b / ufs rw 1 1
/dev/ada1b none swap sw 0 0
to

/dev/ada2a / ufs rw 1 1
/dev/ada2b none swap sw 0 0

the system crashes and I had to work very hard to recover.

I bet! Use -p with gpart and end naming confusions.

Glad to see you have it sorted(?)
 
I have since changed the two /dev lines to
/dev/ada2p2...
/dev/ada2p3....

Then rebooted, and everything works just fine.

Great.

After that, I was able to delete ada1b

When unmounted, I'd # gpart destroy ada1a, then ada1, completely.

You really don't want a "dangerously dedicated" disk in a system that ever runs Windows.

So you should redo ata1 as GPT to match ata2, if that's what you wanted.

I keep forgetting how detailed and thorough gpart(8) is; all of this discussion is far better covered there, and more.

If it's (understandably) a bit big and daunting, I suggest just skimming it to see what's covered including usage examples, commentary on partitioning schemes and types, etc. You only need to remember that you saw something in there somewhere about $whatever :)

Separately: you likely use a fixed-width (monospace) font in xterm, but perhaps not in your browser. If your pastes into the browser are into a mono font, and wrap between [code] and [/code] then results from gpart, mount etc come out clear and neat, aiding intelligibility.
 
OK. Back at it:

I do mount

Returns:
/dev/ada1a on / (ufs, local, soft-updates, journaled soft-updates)
devfs on /dev (devfs)
fdescfs on /dev/fd (fdescfs)
procfs on /proc (procfs, local)
linprocfs on /compat/linux/proc (linprocfs, local)
linsysfs on /compat/linux/sys (linsysfs, local)
devfs on /compat/linux/dev (devfs)
fdescfs on /compat/linux/dev/fd (fdescfs)
tmpfs on /compat/linux/dev/shm (tmpfs, local)

So, ada1a is mounted (?)

Then I do:
umount -v -t 1 /dev/ada1a

Which returns to the command prompt. And this tells me that the command succeeded.

Then I do: gpart destroy /dev/ada1

And returns: gpart: Device busy

So, I try gpart destroy /dev/ada1a

and I get
gpart: arg0 'ada1a': Invalid argument.

If I do gpart delete -i 1 /dev/ada1

I get gpart: Device busy

All I want to do is to get rid of /dev/ada1 so I can use the drive for other things...

Ken Gordon
 
/dev/ada1a on / (ufs, local, soft-updates, journaled soft-updates)
/dev/ada1a is mounted and it's your root.

You can't unmount the root on a running system.

The "device busy" and "invalid argument" responses are stopping you from shooting yourself in the foot.

Edit: if you truly want to blat that disk, boot from alternative media, like a USB stick, identify the disk, and then gpart destroy it.
 
No. ada1 is NOT my root. My root is on ada2.

And this is exactly what has been confusing the heck out of me.

ada2 is not being shown in mount either.

I have been complaining since I began this thread that there is something screwy about the naming of HDDs.

At this point, I am almost certain that the only way I am going to be able to resolve this is to manually disconnect the drive I am not booting from

Ken Gordon
 
Sorry, I didn't read the full history.

Get a bootable USB stick, and boot into rescue mode. Your root will be a partition on /dev/da0. From there you can do what ever surgery you need on the ada disks.
 
If you remove disk drives or swap them round they are most likely to get new names so I would not recommend doing that.

If you physically remove (or disconnect) what is currently ada1 then it is most likely that what is currently ada2 will become ada1 and your system will refuse to boot again.

I would NOT recommend changing anything, but have a read of something like this: https://forums.freebsd.org/threads/labeling-partitions-done-right-on-modern-computers.69250/
 
Yes. I have thought of that. Therefore what I am going to do is to edit my fstab and change /devs from the present / ada2p2 and ada2p3 to ada1p2 and ada1p3, then reboot.

That should work. If it doesn't, I'll figure something else out.

Thanks

Ken Gordon
 
It’s also worth learning how to fix /etc/fstab on a broken system e.g. boot from image and mount “broken” drive and change /etc/fstab and reboot (you may already have done this in the past).
 
It’s also worth learning how to fix /etc/fstab on a broken system e.g. boot from image and mount “broken” drive and change /etc/fstab and reboot (you may already have done this in the past).
Well, I certainly did something like that the last time I had this sort of issue. Thanks!

Ken
 
Ken, from way back in post #5 on Friday, you said:

In the EUFI (whatever) "bios", it shows the HDDs in order as 1) 500 GB (Win10), 2) 160 GB (WinXP), 3) and 4) two identical 2TB drives. When booting the computer, and hitting F-11 to get the choice of boot drives, I see my Win10 drive as the first in the list, the two 2TB drives as next in the list, and the WinXP drive as being the last in the list of HDDs, followed by any USB drives I have plugged in. As I remember it, the CD drive is listed first.

So I guess you used this method of booting when you wound up with ada1a mounted as the root disk (/) with those subsequent difficulties.

Perhaps consider using grub or something else instead for multibooting, since;

The issue comes in that the two 2TB drives will swap "places" in the lineup of drives, depending on which FreeBSD install is complete and active.

So clearly this isn't a viable method of multi-booting this machine.

But meanwhile, you just need to ensure (with gpart show -p and mount -p) that you've booted your [edit:]ada2s2 ada2p2 as root and ada1 is NOT mounted, to be able to destroy ada1a, then ada1, to start again with ada1.
 
… In the EUFI (whatever) "bios", …

As root:

efibootmgr --verbose

What's reported?

Hint: for legibility, please use code block formatting.
 

Attachments

  • 1703690695397.png
    1703690695397.png
    11.9 KB · Views: 36
The system you are running is on ada1.

That is the problem: which physical drive is called ada1 by the system? I insist that keeps changing. So, my solution to figure this out is to physically disconnect the unused drive, reboot, and see what the system calls the drive on which I have my operating FreeBSD install. I am betting that when I do this, the drive which WAS called ada2 by gpart show will now be called ada1.

When I do gpart show as the system is now, the result is (among other things), there are two 2TB drives, one, ada1 is shown as having only a freebsd-ufs listing: no swap, and no boot, or anything else. The other shows ada2 as having three partitions, a boot, a UFS, and a swap. How can the system actually be booting from ada1 when there is neither a boot partition nor a swap partition?

Yet mount shows only ada1 being mounted. It is looking to me as though mount is calling my second, or boot, drive ada1, whereas gpart show is calling the drive on which I have my working install ada2. Furthermore, when I choose my boot drive at startup, it is my second HDD in the list, whereas when I first began this exercise, several months ago, I had attempted my install on the first HDD in my start-up list. I have since "deprecated" that install and want to use that HDD for other things.

It seems to me that it is not a naming issue but a boot issue.
I am not sure what you mean by a "boot issue". In any case, I will get it figured out. Thank you for your input.

Ken
 
When I do gpart show as the system is now, the result is (among other things), there are two 2TB drives, one, ada1 is shown as having only a freebsd-ufs listing: no swap, and no boot, or anything else.

I showed you. Trust gpart, and mount - not your UEFI naming.

ada1 has now only ada1a, a BSD scheme, but that's enough to boot and run. Only ada2 (GPT scheme) needs a boot partition, and still has swap, so ada2p1, ada2p2 and ada2p3.

mount clearly showed ada1a as root (/), so that's what your UEFI booted. Trust what gpart show -p and mount -p are telling you. You have to boot from ada2p2 as /. Only then can you destroy the bogus "dangerously dedicated" ada1a and then ada1.

The other shows ada2 as having three partitions, a boot, a UFS, and a swap.

Yes, and that's what you want to boot from, but now you are NOT. Believe gpart and mount, and use -p to clearly see partition names, please.

How can the system actually be booting from ada1 when there is neither a boot partition nor a swap partition?

Because BSD scheme includes the boot code area, and swap is not needed till you run out of memory. Get rid of the damn thing and all this will go away.
 
Ha ha! :)

Well, I physically disconnected and removed the problem drive, and cannot boot into my FreeBSD install at all.

Here is what I get:


FreeBSD_boot.jpg
 
Now, although I have seen this mountroot thing before, I was always able to, eventually, get past it and boot into my FreeBSD install just fine. Now I cannot. I suspect that the install on this HDD does not contain anything bootable, despite what gpart says.

So, when I was told that I was actually booting from ada1, while I have my entire install on ada2, that was correct.

I have tried about every combination of ufs: /dev/ada1p* and gpt: /dev/ada1p* etc. Some fail with error 22, some fail with error 2.

SO.... I am going to now build a bootable FreeBSD on a flashdrive and attempt to "rescue" my system. If that doesn't work, I'll just have to bite the bullet and do a complete reinstallation.

Later.

Ken
 
Darn it!! While I was noodling around the forum on my cell phone, I stumbled on some sort of "how to" on how to use a bootable DVD to fix an unbootable FreeBSD install, but now I can't find it. Might anyone here know what I am describing? I have not been able to find it in the How To section of the forum.

Ken
 
Back
Top