Accidentally deleted /bin directory

I was running an installation of 13.1 with 2 operational jails and trying to get a 3rd up and running. 3rd one wasn't working out so well so I decided to nix it. I was having trouble deleting the file system for said 3rd jail and in the process deleted my host systems /bin directory. Does anyone have any insight as to how I may, if it's possible, replace the directory via another machine and get my system back up and running? I've tried attaching the disk to a VM running the same freebsd build but when I try and mount the drive I'm receiving "unknown special file or file system".
 
Can you say more about the setup of the host? By the sound of it, the host machine is a virtual machine, but in what hypervisor (e.g. bhyve, VirtualBox)?

It looks like a lot of tools for mounting drives are in /sbin. While they could wind up having dependencies on programs in /bin, have you tried putting the contents of /bin on a virtual or physical drive, then mounting it on the affected host via the hypervisor? From that drive, you might be able to execute cp to copy over /bin.
 
I would boot the install ISO - there's an option to boot a live system; It should be able to mount your drive, and so you can simply copy the missing directory to it (the install medium also offers a shell, but at least I failed to mount my disk from there as the needed devices weren't created).
 
You can copy /bin directory contents off of the install CD, or of an online mirror. Though be sure you check the command and the directories in them, before you press enter on the command.
 
I was running an installation of 13.1 with 2 operational jails and trying to get a 3rd up and running. 3rd one wasn't working out so well so I decided to nix it. I was having trouble deleting the file system for said 3rd jail and in the process deleted my host systems /bin directory. Does anyone have any insight as to how I may, if it's possible, replace the directory via another machine and get my system back up and running? I've tried attaching the disk to a VM running the same freebsd build but when I try and mount the drive I'm receiving "unknown special file or file system".

Assuming that you were using 13.1-RELEASE: Download the base system tarball (https://download.freebsd.org/releases/amd64/13.1-RELEASE/base.txz), extract it into a new temporary destination (e.g. /bin/mkdir /tmp/base && /usr/bin/tar -xpf /path/to/base.txz -C /tmp/base) to expand the default hierarchy, and then recursively copy /bin from /tmp/base/bin back into place (e.g. /bin/cp -fpPR /tmp/base/bin /bin).
 
Download the base system tarball (https://download.freebsd.org/releases/amd64/13.1-RELEASE/base.txz), extract it into a new temporary destination (e.g. /bin/mkdir /tmp/base && /usr/bin/tar -xpf /path/to/base.txz -C /tmp/base)
The problem: Without the bin-directory there is even none of the default shells available (means also: no login as well as your mkdir-command…). But 20 days later without a feedback from the OP I think there's no more help needed ;)
 
The problem: Without the bin-directory there is even none of the default shells available (means also: no login as well as your mkdir-command…). But 20 days later without a feedback from the OP I think there's no more help needed ;)
Ooo... you're right! Time to boot from a rescue drive!
 
Back
Top