Solved Partial install 10.4

Here's the situation that I have.

My BSD machine is a dual HD system. The first HD has /, /tmp, /var, /home, and swap partitions. The second HD has just /usr. Well, the second HD failed. The system will boot up in single user mode, but with the entire /usr partition missing, it's not very useful.

So, my question is how do I do a partial install of the /usr directory? Also, I can't seem to find bsdinstall on the part of the system that I currently have, which would make things much simpler. I want to avoid a full install though because the first HD has useful data on it in the /home partition.
 
First make a backup of the stuff you want to keep, just to be safe. Then add a new disk with a new /usr/. Make sure it's mounted and use the files from a installation CD or memstick. The installer really doesn't do much more than extract files from the /usr/freebsd-dist directory. With those files you should at least be able to get the base system complete again. Complete enough to work from.
 
It's a fairly old schema, back in the day /usr/ was always a separate filesystem. Nowadays it's probably better to keep /usr/local/ separate and keep /usr/ on the root filesystem.
 
I've used this setup for 20 years. Because /usr takes up lots of space, it seemed like a good idea. I replaced the HD and reinstalled 10.4. I was able to copy the /home directory off the system. I think I will do something a little different. The big directories are /usr/src /usr/obj/ /usr/local, and /usr/ports. I would like those on a separate drive.
 
I replaced the HD and reinstalled 10.4. I was able to copy the /home directory off the system.

That was unnecessary. As SirDice said, you could have grabbed /usr from an installation ISO:

1. mdconfig -t vnode -u 99 -f FreeBSD-10.4-dvd1.iso
2. mount_cd9660 /dev/md99 /media
3. cd /media/usr/freebsd-dist/
4. /media/usr/bin/tar --unlink -xvpf base.txz -C / ./usr

Well, except for the fact tar is located on /usr/bin/ :mad:. So you'd have to copy over the tar program from the ISO, too.
 
Well, I have the backup done. I think I will take the opportunity to reformat the entire machine and move to 11.1. So what should the disk layout be nowadays. The last time that I have actually sat down and read the handbook was when I first started FreeBSD, and that was when 3.4 was current. I bought the disks and the book as a package. Currently, these are the sizes and layouts for the partitions:

  • ada0a 1024MB /
  • ada0b 4096MB swap
  • ada0d 4096MB /tmp
  • ada0e 4096MB /var
  • ada0f rest of disk /home
  • ada1a all of disk /usr
 
SirDice's suggestion above about keeping /usr on ada0a, and placing /usr/local on ada1a seems like a good one. You can throw /usr/ports/, /usr/src, and /usr/obj on ada1a as well.

Which is what I did. ada1 has separate partitions for src, doc, obj, ports, and local. I may adjust the sizes as I get a handle on how much space stuff needs, but I think it's a good layout.
 
I may adjust the sizes as I get a handle on how much space stuff needs, but I think it's a good layout.

Sounds prudent. But why not use zfs() datasets with quotas enabled instead. Would be easier to adjust their sizes than having to repartition your disk drive when|if the need arises.

Code:
quota=size | none
         Limits the amount of space a dataset and its descendents can consume.
         This property enforces a hard limit on the amount of space used. This
         includes all space consumed by descendents, including file systems
         and snapshots. Setting a quota on a descendent of a dataset that
         already has a quota does not override the ancestor's quota, but
         rather imposes an additional limit.

         Quotas cannot be set on volumes, as the volsize property acts as an
         implicit quota.
 
Never really used zfs since ufs is what I have used since I started using FreeBSD back when it was 3.4.
 
Never really used zfs since ufs is what I have used since I started using FreeBSD back when it was 3.4.

I was the same way until last year. I've been Using FreeBSD since version 2.2.1. ZFS is well worth looking at if you have a remotely modern system (my definition is at least 4GB of RAM and more than a single HDD). It might even be worth it on a single disk system.

  • Easy setup of mirrors when you have 2 (or more) disks.
  • Quick snapshot of current state before you try something risky with software and then restore the snapshot when it goes wrong.
  • Ability to create and destroy filesystems as you need them (in my case I don't normally use ports but when I do, I create a /usr/ports and such).
  • Ability to "share" free space between filesystems (no more need to worry that you made /home too small and /usr too big)
 
The machine stats are as follows:

  • AMD Athlon Thunderbird 1.4GHz
  • 2GB RAM
  • HD1 PATA 40GB
  • HD2 PATA 120GB
I do plan to upgrade it sometime in 2019, but it works fine for what I use it for.
 
Back
Top