UFS How to add old FreeBSD system disks to new system for additional storage, without losing data?

Apologies in advance if my questions are fundamental. First, some history to illustrate my knowledge level. I have been using FreeBSD for years as a desktop (since version 5.something or 6) and generally keeping the system and ports updated (with a foray or two into fixing an occasional broken port update), but that's about as far as my FreeBSD knowledge goes. Haven't been using a printer, USB drives, or doing anything fancy with disks (different filesystems, raid arrays, etc).

In the past, when I've done a complete reinstall to a new disk, I would set the old disk up in a separate machine, boot the older FreeBSD, and transfer my files via FTP to the new machine, keeping the old disk as a sort of backup when I was finished copying the files to the new machine. However, that is very cumbersome and time-consuming, and I'd like to avoid it this time if possible.

Recently, I found myself woefully behind on updating, so I've just installed Release 12.0 on a new 1tb SSD. The old disk was in a hot swappable bay I've had in the computer for a couple of years (installed due to paranoia after a burglary, so I could keep the disk with me), but I pulled the old disk out while I installed 12.0 on the new SSD, because I was worried about messing up and choosing the wrong drive to install on.

So, to cut to the chase, I have a machine with a new SSD with the OS (12.0 Release) and programs on it, 2 hot swap bays in the machine (just added another), and two 1tb drives (both with older bootable FreeBSD systems, the most recent has my personal data and configuration files that I'd like to keep). I would like to keep the SSD limited to the OS and programs for now if possible, and use the other two drives as my personal storage, one disk for regular use, and one to do backups on. My questions relate to this setup and how to achieve it. I have tried to look this up, and all the directions I have found refer to either adding a new disk to be partitioned, or adding a disk with existing data to a ZFS pool or RAID, neither of which seem to apply to my situation. (Yes, I have RTFM, too, many times.)

edit: Having written this out, I don't think this is all that complicated and I may have figured it out, but I also may be being somewhat blinded by my concern over keeping the data. Or I may be overthinking it, since I've been known to do that too. :sssh:

I'd like either some reassurance that I'm going about this in the right way, some redirection where I may be going wrong, or suggestions for a better way I haven't thought of. I really just want to keep this as simple as possible (and the data safe, of course).

How do I add the older drives? Is it as simple as just plugging them into the bays, making sure the BIOS (or UEFI, I suppose) sees them, then booting the new 12.0 drive and making sure FreeBSD sees the older ones as it runs through its bootup?

Then I would have to mount them before I could access them, I'm sure (never done much mounting). And I should add them to /etc/fstab to have them mounted at boot automatically, right? If I removed the oldest one (being used as the backup drive), would it be a problem to have it automatically mounted at boot but then suddenly it's not there? I guess I could comment out that line before I shut down, when I was plannng to remove it, right?

I guess it might be helpful to label these disks so I can be sure which ones I'm accessing and so the names don't change around? Is this a good set of instructions to follow: Labeling partitions done right on modern computers?

I don't know what partitioning scheme is on the two older drives, so I don't know if they can be labeled with that method. It would be whatever the default partitioning scheme was at the time I originally installed those systems, with the oldest in 2014, I think, and the newer maybe around 2016. Is there a way to find that out from the drives?

Once they're mounted, is there any chance FreeBSD will get confused since there is currently an entire system on both of those drives, so it would see three /usr/homes, three /'s, etc? (There's definitely a chance that I might get confused.) Is there something I should do to avoid either possibility?

What would be the best way to use them the most transparently, that is, with the minimum amount of fuss? Maybe have symbolic links from my 12.0 home directory, i.e. ~.old and ~/older? And if I had symbolic links named something like that, maybe having a label wouldn't matter as much because the link name would make it clear?

Then, I suppose it will be ok to delete the OS from the previous drives, once I'm sure I won't need to boot off that drive, and as long as I make sure of which drives I'm deleting the OS from? Might be good to keep it on the newer one (of the two old drives), just in case?

Thanks for your thoughts and any answers, and also for all the answers I've gotten over the years without ever having to post and ask for them. 🍷
 
would it be a problem to have it automatically mounted at boot but then suddenly it's not there? I guess I could comment out that line before I shut down, when I was plannng to remove it, right?
Actually there is an fstab option for that: FAILOK

Just mount your two disks at some mountpoints like /olddisk1 and /olddisk2
Simply make your mountpoint directories on the SSD. mkdir /olddisk1 & mkdir /olddisk2
First you want to scope out your old drives with ls /dev to show disk partitions. gpart show will work too.
You need to figure out what is swap drive and whatever else exists on the old disks.
file -s /dev/ada1s2a
This command will show you what type partition is located at disk ada1 -Slice 2.

Once they're mounted, is there any chance FreeBSD will get confused since there is currently an entire system on both of those drives, so it would see three /usr/homes
Well your fstab points to the root drive so no, there should be no confusion.

If your old drives contain many separate partitions (ie: separate /usr, /home, /boot) this could be more of a pain to do.
 
You might need to figure out how the motherboard SATA connectors are numbered and use SATA1 connector for the SSD.
That way the SSD root drive stays at ada0 and then when you add the old disks they should be ada1 and ada2.

You should also investigate the bios for disk settings. For using a disk cage there is s SATA hotswap setting to set.
 
Thank you, Phishfry.

You might need to figure out how the motherboard SATA connectors are numbered and use SATA1 connector for the SSD.
That way the SSD root drive stays at ada0 and then when you add the old disks they should be ada1 and ada2.

You should also investigate the bios for disk settings. For using a disk cage there is s SATA hotswap setting to set.

Oh, that's a good idea! The CD/DVD drive is on SATA 1, but it will never move, so I'll put the SSD on 2, where the first cage is now. The second cage that I just installed is on 3, and the SSD is currently on 4. So I'll change them around so they stack up in the order I want to think of them.

I've looked through the motherboard manual for a SATA hotswap setting, but don't see one mentioned there. When I reboot again, I will check in the BIOS itself since the mobo manual leaves a lot to be desired in the way of explanations, but since I'm not actually doing hot swapping, just using the cages for a way to get drives in and out without opening the box and fiddling with cables, it should be ok if I don't find a setting for that. It would be convenient, though, to not have to shutdown to remove the backup drive.

Actually there is an fstab option for that: FAILOK

Wonderful! Thanks!

Just mount your two disks at some mountpoints like /olddisk1 and /olddisk2
Simply make your mountpoint directories on the SSD. mkdir /olddisk1 & mkdir /olddisk2
First you want to scope out your old drives with ls /dev to show disk partitions. gpart show will work too.

You need to figure out what is swap drive and whatever else exists on the old disks.
file -s /dev/ada1s2a
This command will show you what type partition is located at disk ada1 -Slice 2.

Well your fstab points to the root drive so no, there should be no confusion.

If your old drives contain many separate partitions (ie: separate /usr, /home, /boot) this could be more of a pain to do.

When I installed on the SSD, I deleted the swap slice that the installer created and made a swapfile instead because it was recommended here: Using a Solid State Drive with FreeBSD - Swap.

Side question: However, I forgot to reallocate the 3.5 gb the installer set aside for swap and now have that space as free. Is there a simple way to add that into the ufs partition, or is there a good reason to just leave it unused?

Are you suggesting I should add the swap partitions from the old disks to /etc/fstab also?

I think the old disks have 3 partitions each: boot, ufs, and swap. Going back to the 9.2 handbook, which would have been the version I installed in March 2014, by then the installer had started putting everything into one (ufs) except boot and swap. I remember that got some discussion here at the time about whether it or the old way was better, but I just went with the defaults.

Thank you for the pointers. You focused my thoughts about this, and I have a better idea of what I need to read up on now. I may have more questions as I proceed, but will see what I can do on my own first. I'll let you know the outcome, but it may be a day or two. :)
 
is there a good reason to just leave it unused?
Not really.
Are you suggesting I should add the swap partitions from the old disks to /etc/fstab also?
No not at all. I just wanted to make you aware they might be there.
by then the installer had started putting everything into one (ufs) except boot and swap.
Good. So an example fstab might look like this for olddisk1:
/dev/ada1s2a /olddisk1 ufs rw,FAILOK

First it would not hurt to fsck the olddisk, then manually mount just to ensure it is OK.
mkdir /oldisk1
mount /dev/ada1s2a /olddisk1
ls
umount /mnt
 
Hi Phishfry. I have my most recent old disk in the machine and can access it, and copy files from it. I haven't tried writing to it yet, but I don't expect that will be a problem. I haven't set it to mount automatically yet.

I wish I could say everything went perfectly, and I was done in half an hour, but unfortunately, I can't. For reasons I don't understand, I had trouble getting the drives on the SATA ports I wanted them on. The motherboard is marked as to which ports are which, but they seemed to jumble around in the BIOS, depending on what I put on them. I put the CD/DVD physically on port 1, the SSD on port 2, the most recent old drive (a Western Digital) on port 3, and the 2nd empty cage on port 4, but when I went into the BIOS, it showed them as port 1: WDC, port 2: SSD, port 3: CD/DVD , and of course, not present for port 4 since I hadn't put anything in the 2nd cage.

So, I thought maybe the board might be mismarked, and I swapped the WDC (to marked port 1) and the CD/DVD (to marked port 3). But then the BIOS saw them as they were physically! Since I still wanted the SSD first or second in the bios, I did more cable shuffling, rebooting, going into the BIOS to check, and letting the 2 FreeBSDs boot. I had problems with the drive was on physical port 3 going to single user mode instead of booting normally.* Both the new 12.0 and the old 10.something system did this when the BIOS saw them as being on port 3.

So, back I went into the box, and replugged everything again a few times and did the reboot/check routine again, trying to figure out what plan would work to let my drives stay as ada0 for the SSD, ada1 for the WDC, and ada2 for the eventual 3rd drive. Did some searches to see if I could understand what was going on, but found nothing.

Finally, I unplugged the WDC completely, put the CD/DVD on physical port 5 just to be extreme (would have put it on 6, but the cable wouldn't reach), and the SSD on port 1. Rebooted, and they were on the right ports in the BIOS now! Let it go into FreeBSD 12.0, and it booted normally. Back into the box, and put the WDC on port 2 (I think, but I'm not opening the box again right now), and so I have been able to boot into 12.0, mount the WDC on /olddisk, and copy my .mrxvtrc so at least the terminal in X looks normal.

I don't know where the 2nd cage will show up in all this when I plug a drive into it, though, so I haven't added the WDC into /etc/fstab. I also don't know if the WDC will boot into the older FreeBSD, but I won't push my luck right now, I'll just get the stuff from it that I need to get my new system configured as it should be.

I did find that the BIOS has a setting for each SATA port, called SATA ESP, and this Q/A I found makes it look like it also controls hot swapping. What do you think? (My motherboard is also an ASUS, a M5A97 R2.0.
Question on Stack Exchange: What does “SATA ESP” (“Set SATA PORT1 to External SATA Port”) do?

Also, in the section of the BIOS for "Boot Override", which is an instant boot menu, at one point (I can't remember how I had the plugs when I made the note, though), it showed a choice of:
UEFI OS (P3: CT1000MX500SSD1)
P1: TSSTcorp CDDVDW SH-224DB
P0: WDC WD10EZEX-08M2NA0 (953869MB)
P2: CT1000MX500SSD1 (953869MB)

I have to boot from the UEFI OS one to get into the 12.0 system. Is that the efi partition that the installer made? Why is the BIOS seeing it as if it's a separate disk? That's only in the Boot Override, though, not in the SATA configuration screen. It's showing me bootable partitions? But the P2 one there won't boot, just gives me the modernized "insert a disk" message. Does this shed any light on why the port numbers are shuffling around?

Anyway, I thank you again for your help. I will probably not plug the other hard drive (also a WDC 1tb) in till next weekend, because I still have plenty to do just to get to where I was with programs configured and interface set up the way I'm used to. But I'll follow up and let you know what was involved with getting it in the ada2 slot (how much more cable shuffling I have to do, I will skip the details, though, lol) once I do. And I wonder how (or if!) the BIOS will distinguish between the two for me...

* Example from old WDC disk booting as ada0, SSD was seen as ada1, but appeared after cd0 in the bootup sequence:
Code:
Starting file system checks:
/dev/ada0p2: FILE SYSTEM CLEAN: SKIPPING CHECKS
/dev/ada0p2: clean 35523161 free (288673 frags, 4404311 blocks, 0.1% fragmentation)
(skip some lines about uhub* loading, then the USB mouse and keyboard loading)
Mounting local file systems: KLD fdescfs.ko: depends on kernel - not available or version mismatch
linker_load_file: /boot/kernel/fdescfs.ko - unsupported file type
mount: fdesc: Operation not supported by device
.
Mounting /etc/fstab filesystems failed, startup aborted
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
June 1 15:59:59 init: /bin/sh on /etc/rc terminated abnormally, going to single user mode
Enter full pathname of shell or RETURN for /bin/sh: uhub4: 4 ports with 4 removable, self powered 
uhub3: 5 ports with 5 removable, self powered 
uhub6: 5 ports with 5 removable, self powered
 
I had a good experience with this topic
I move FreeBSD server from old Desktop case to HP server by use CloneZilla everything works well. old servers were Pentium 3 and move to new HP servers by Xeon CPU.
but some config most change.
I use Live Clone. I give old Servers and new Servers IP.
 
I don't know where the 2nd cage will show up in all this when I plug a drive into it, though,
I know that feeling. Just last night I was battling NVMe and what slot they get plugged in and device priority(really set by PCI BUS ID's which can move around too)

I might have sent you on a goose chase if you do not need hotswap. I am not fond of hot plugging at all. (Electrically/Static)
Hot unplugging with proper dismount and camcontrol disconnect works fine.
I did find that the BIOS has a setting for each SATA port, called SATA ESP, and this Q/A I found makes it look like it also controls hot swapping. What do you think? (My motherboard is also an ASUS, a M5A97 R2.0.
Do you need hotswapping? Maybe put it on a todo list after you get your files straight and backed up.
.
Also, in the section of the BIOS for "Boot Override", which is an instant boot menu, at one point (I can't remember how I had the plugs when I made the note, though), it showed a choice of:
UEFI OS (P3: CT1000MX500SSD1)
P1: TSSTcorp CDDVDW SH-224DB
P0: WDC WD10EZEX-08M2NA0 (953869MB)
P2: CT1000MX500SSD1 (953869MB)
Yes this is a critical page many people miss.
This will allow you to force any boot mode you want. For instance a misbehaving EFI BIOS that you need to force the USB stick to UEFI mode to get a EFI install.
This override settings also mirrors the press "F10/F11/F12 key for Boot Menu" that many boards have.

But in your case it would allow you to boot to other devices.
For you this will be havock (Mountroot prompt), unless you modify /oldisk/fstab and adjust the drive mount.
So you will look for "ada0" or if a real old FreeBSD disk "ad0" inside your /olddisk/fstab
This line needs to be changed to reflect where it ended up in your arrangement.
For instance change /oldboot/fstab to "ada1". This will need to be for all lines that point to either ada0 or ad0.
Then reboot and give it a whirl. Look at bootup for BootMenu shortcut key. It varies by machine. F10 / F11 / F12 key.
You may need to set the BIOS settings to enable CSM for Legacy booting the old drives.

I have to boot from the UEFI OS one to get into the 12.0 system. Is that the efi partition that the installer made?
Yes there is an EFI partition usually ada0p1. This contains one file that kickstarts the whole thing. The BIOS reads this file.
It searches disks for /EFI directory and its EFI payload.
 
I had a good experience with this topic
I move FreeBSD server from old Desktop case to HP server by use CloneZilla everything works well. old servers were Pentium 3 and move to new HP servers by Xeon CPU.
but some config most change.
I use Live Clone. I give old Servers and new Servers IP.

Thank you for replying, mfaridi. This wouldn't have worked in my case, I don't think, because I wasn't bringing a whole hard drive over to a new one, I just wanted to make sure to keep part of my home directory from the old drive that I didn't want to lose. I installed a fresh version of FreeBSD so I could get rid of the clutter from older installations and not worry with updating. Sometimes it's better just to start out clean, you know?

But I appreciate your input and will keep this in mind if I need to clone a whole hard drive.
 
I know that feeling. Just last night I was battling NVMe and what slot they get plugged in and device priority(really set by PCI BUS ID's which can move around too)

I had to look NVMe up - looks like another new technology I'll just be catching up on as the next big thing is coming in. Haha!

I might have sent you on a goose chase if you do not need hotswap. I am not fond of hot plugging at all. (Electrically/Static)
Hot unplugging with proper dismount and camcontrol disconnect works fine.

Do you need hotswapping? Maybe put it on a todo list after you get your files straight and backed up.

No problem; I learned some stuff I didn't know, which is always a good thing. I don't actually need hotswapping, might be nice, but not a must-have. There's no reason I can't shut down to change the drives in my cages. It's not like it's a public server where you don't want to disrupt other users. (I adminned for a while on a cPanel server for a forum - what a nervewracking situation! If the server was down for anything longer than a quick reboot, the rumor mill in the community would start grinding.) Yes, on the todo list seems like a good place for it; it will have plenty of company there.

Yes this is a critical page many people miss.
This will allow you to force any boot mode you want. For instance a misbehaving EFI BIOS that you need to force the USB stick to UEFI mode to get a EFI install.
This override settings also mirrors the press "F10/F11/F12 key for Boot Menu" that many boards have.

But in your case it would allow you to boot to other devices.

I found that out accidentally, when it looked like it might be for a setting I could make, but it rebooted instead. I was hoping to find something that would let me assign the ports in the bios to the different drives, since the numbers on the board didn't seem to correspond with the bios. I didn't find a setting like that, though.

For you this will be havock (Mountroot prompt), unless you modify /oldisk/fstab and adjust the drive mount.
So you will look for "ada0" or if a real old FreeBSD disk "ad0" inside your /olddisk/fstab
This line needs to be changed to reflect where it ended up in your arrangement.
For instance change /oldboot/fstab to "ada1". This will need to be for all lines that point to either ada0 or ad0.
Then reboot and give it a whirl. Look at bootup for BootMenu shortcut key. It varies by machine. F10 / F11 / F12 key.
You may need to set the BIOS settings to enable CSM for Legacy booting the old drives.

I will add that to the todo, ahead of the hotswapping. Fixing up the fstab sounds more useful, as a fallback if I ever need it. But I'll need to wait till my drive locations are settled before I do that. I think the Boot Menu is F8 on mine - it shows that in the bios, right next to the override buttons.

Yes there is an EFI partition usually ada0p1. This contains one file that kickstarts the whole thing. The BIOS reads this file.
It searches disks for /EFI directory and its EFI payload.

So is it kind of like the older MBRs? I never really had a good understanding of what happens at that level of bootup.

I am slowly getting things back to normal, got my wmaker looking and acting like it should, regular programs I use are mostly installed and their configs are getting copied over, etc. One of the reasons I like FreeBSD so much is there are no visual and operational changes to the main interface unless I make them. I feel disoriented by unexpected interface changes when I'm just trying to get stuff done.

I can access my email again, which is retrieved from various accounts "out there" by another FreeBSD machine (in the closet, lol) and accessed by IMAP, but I would like to eventually move all that (a postfix, dovecot, getmail, maildrop, and spam filtering combo set up long ago) over to this one and shut down the closet machine so I only have one to keep updated.

So it's good to be making progress, getting back into my normal routine of using the computer instead of working on it, even though I still have a lot to do. I'm also trying to take the opportunity as I set stuff up again to learn more about it as I go (read more carefully than I did the first times around). I'll get there, just a bit at a time. Thanks for all the help; I sure appreciate it.
 
Back
Top