Installing to new drive within running system? reddit / freebsd ---------------------------------------------------------------------- manys · 2021-05-15 19:45 Necessity is the mother of invention, so I'm trying to figure out new and exciting ways of managing one of my personal servers remotely. As it turns out, this machine needs to be upgraded from spinning rust to an SSD. The SSD is already installed. I've been idly trying different rsync, cpdup, dump/restore, etc. experiments to see if anything convinces me to, y'know, *edit /etc/fstab && reboot now* from 50 miles away. I've finally concluded that I'd like to just install a new FBSD 13 to the new drive rather than duplicating the old drive and upgrading in place. The old one has been upgraded over the past 10 years or so, so there's plenty of cruft and detritus to sweep out. So! Install and copy data, fine. Can I do this within a live system to a blank drive? I'm prepared for "no," but I'm hopeful for "yes!" OK, I realize none of this actually qualifies as "necessity" in birthing invention, but I can't think of a positive version of 'curiosity killed the cat.' ---------------------------------------------------------------------- reddit_original · 2021-05-15 21:04 That it's 50 miles away or under your desk doesn't make any difference. How you do it will be the same. Yes, you can do this but, unfortunately, I did it once long ago and wouldn't count on my memory to remember how. ---------------------------------------------------------------------- converter-bot · 2021-05-15 21:04 50 miles is 80.47 km ---------------------------------------------------------------------- manys · 2021-05-15 21:12 Oh I know, but I've learned that they're different levels of risk. :) ---------------------------------------------------------------------- AGodThatCanDance · 2021-05-15 21:19 1. partition the new drive using `gpart` 2. `newfs` or `zpool create/zfs create` to setup/prepare the partitions. 3. You may also need to setup boot partition (ESP for UEFI), or `freebsd-boot` for BIOS based booting with GPT drive 4. download/extract freebsd tarballs from `https://download.freebsd.org/ftp/releases/amd64/${VERSION}/` 5. Prepare `fstab(5)` 6. Setup `root` password 6. Add SSH public keys for `root` user 7. Update network configuration in `rc.conf(5)` 8. Review any other configuration, `rc.conf(5)`, `loader.conf(5)` 10. The last part will be tricky, as it requires switching boot device to SSD from HDD. It's best if you're using UEFI, that way you can use `efibootmgr` to setup new boot entry, and reorder boot choices. For BIOS, would be nice if you have IPMI access to your remote host, so you can re-order boot devices. otherwise, as a backup you need to mess with FreeBSD's loader with `vfs.root.mountfrom` option, and will be forever dependent on current HDD being available. You can look at `bsdinstall` sources for hints. Good luck! ---------------------------------------------------------------------- reddit_original · 2021-05-15 21:52 They are not. It makes no difference. ---------------------------------------------------------------------- manys · 2021-05-15 22:24 You know better than I do. ---------------------------------------------------------------------- Ben_ze_Bub · 2021-05-16 07:44 Well, the difference would be how far you have to stretch your arms to insert the recovery stick in case something goes wrong. ;) ---------------------------------------------------------------------- grahamperrin · 2021-05-16 08:42 If you feel adventurous, you might: 1. backup 2. partition the drive 3. chroot to the required part 4. use (alpha) PkgBase https://alpha.pkgbase.live/ to install FreeBSD 13.0-RELEASE 5. assuming EFI, populate the ESP as outlined at https://www.freebsd.org/releases/13.0R/relnotes/#boot Beyond that, I can't visualise how the first boot will behave, but I guess that it'll be appropriate to run [adduser\(8\)](https://man.freebsd.org/adduser\(8\)) and so on. ---------------------------------------------------------------------- core-kartana · 2021-05-16 10:06 I haven't tried it but I imagine it is a bit like installing gentoo. You already have a live system running so it is a matter of formatting the drive, copying the file from the boot image to the drive, chrooting to that drive and installing the software. Easier written then done I know. ---------------------------------------------------------------------- manys · 2021-05-18 00:12 This looks totally doable, but at the same time the project is looking a little stale. I'll poke around with it and see how far I get.