Moving my system to a bigger drive

Hi there! Sorry if this is the wrong place to post this, but I am not 100% sure where to do it:

The issue is about what the title says: I got a Thinkpad T420 last year, and wanted to test some different OS on it. FreeBSD was one of them: The thing is that it came with a 250GB SSD, and after this year I decided I want to keep FreeBSD as my daily driver, but I am struggling for space. Currently I have a partition for FreeBSD, and another one for OpenBSD. I got a drive twice the space, but I am thinking that I want FreeBSD as the main partition, and two smaller ones for Haiku OS, and FreeDOS. I don't think I need to give any of those over 1GB each, so it is moving to a bigger drive, and change the geometry.

Now, my idea when I got this drive, was just to reinstall everything, but after all this time, I got a system I am currently really happy with. I have been a Linux user for 20 years, so I am aware of tools there to clone and resize partitions, but on BSD, hard disk management tools are quite different. Again, I could just reinstall, but I would like to know if I could have a more elegant solution than copy config files from an external drive. I also managed to get a very sweetly configured machine, so I would love if I could just migrate it, resize partitions, and set up the new secondary two OS.

Any ideas? And thanks in advance!
 
If I understand you correctly, you are just trying to move your FreeBSD installation from one drive to another empty drive. You are not trying to move partitions around and resize on a single drive.

If that is so, you can just use dump(8) or just cp(1) to copy the filesystem from one disk to another then use growfs(8).

Use gpart(8) create and then add to create the new disk's partition table and partition. Once you do that, the new device partition will show up, ex: /dev/ada1p1

Copy the filesystem to that device, ex: dump -fL /dev/ada1p1 /dev/ada0p1

Grow the new filesystem to fill its partition, ex: growfs /dev/ada1p1

Make sure you mount that new disk and fix the fstab entries.

If you do not remove your current FreeBSD partition, you may have problems booting. If you do not remove it, explicitly set the root in /boot/loader.conf on the boot drive with, ex: vfs.root.mountfrom="ufs:/dev/ada1p1"
See loader.conf(5) for how it determines how to boot.
 
  • What file system is the original installation using, UFS2 or ZFS?
  • Which FreeBSD version is installed?
  • Tell us about the system firmware boot method. Is it legacy BIOS or UEFI?
 
Any ideas? And thanks in advance!
While jwillia3 way is SAT I am a dd guy. Since new drive is bigger I would just dd the whole thing to new drive.
Then with extra space you could add your Haiku partitions or delete anything unneeded.

Once you dd your new drive and resolved partitions you have to expand the FreeBSD filesystem.
For UFS First Grow the FreeBSD partition
example:
gpart resize -i2 ada1 << Notice it uses INDEX number for partition as found in gpart show
then:
Grow the new filesystem to fill its partition, ex: growfs /dev/ada1p1
 
Copy the filesystem to that device, ex: dump -fL /dev/ada1p1 /dev/ada0p1

Grow the new filesystem to fill its partition, ex: growfs /dev/ada1p1
Note that you can restore in an existing filesystem. So I would create a bigger partition on the bigger disk, newfs it and then dump/restore.
 
If ZFS a way is to use a bigger drive and then mirror. After resilver done, you could break the mirror and have bigger space
 
TBH, I wouldn't personally bother trying to move disk partitions over, even when it does work it can get messy. If you've got the option, it's probably the most straightforward to just do a completely new install on the new disk and then transfer things like /home over to the new disk. Any directory that's not part of the core install is probably not a problem to just copy directly over, just mind the permissions if you've done anything non-standard and ensure that if you're trying to bring users over that you've accounted for any possible UID and GID changes.

I personally keep a bunch of notes about stuff related to rc.conf pf.conf, loader.conf and any configurations related to software I've installed. If you aren't using pkgbase yet, freebsd-update IDS will give you a fairly good sense of what files in /etc have been modified. Or, you can also just use diff to do that as well.

As a side benefit, it's also a great practice for the next time there's a major update as it's generally better to just reinstall when going between major releases, even if not technically required.
 
Hi, reading the comments:

I am using UFS, as I am limited on RAM and I understand the logic of it much better.
I am on 15.0-Release 9
And I am using BIOS, not UEFI

For what I read, It would be better to reinstall, I might want to find another solution, just to learn and familiarize myself better with BSD. I do know Gparted well, just trying to learn something new. For now, my main "nuissance" is that I am using WindowMaker, and because the official repo is not that well stocked with applets, I did manually compile a bunch. Not the end of the world, because I am keeping all repos on my /home and I can just recompile. That said, I might end just reinstalling.

The main issue I see now, is that I have a good portion of my hard drive dedicated to OpenBSD. As I want to install two much smaller systems, I might also want to change the partitions to give more space to FreeBSD, and less to other OS in percentage. As I said: 2GB should be enough to reserve, plus a bit on unused space for the SSD for longevity reasons: I didn't do that, thinking to use the SWAP space instead, as I do with Linux, but I also notice that it is very common to end using SWAP with FreeBSD if you don't shut it down regularly.
 
BTW, I never heard of Pkgbase. Is there any specific benefit over freebsd-update? I am not completely new to FreeBSD, but I had a long pause, and when I left I wasn't exactly an expert.
 
BTW, I never heard of Pkgbase. Is there any specific benefit over freebsd-update? I am not completely new to FreeBSD, but I had a long pause, and when I left I wasn't exactly an expert.
It's still optional. It just uses the same tools for updating the system as we use for packages. Right now, you can stick with freebsd-update if that's what you're comfortable with, but on the whole the pkgbase seems to be fine.

You don't have to reinstall, it's just straightforward and limits the stuff that can go wrong between starting and having a functioning system from which to finish copying the non-system files you're looking to transfer.
 
Back
Top