Reinstall to increase swap but keep settings and quickly reinstall packages

As my (the default) swap is too small (2G) and I cannot enlarge it, the general wisdom states to reinstall the OS. But how can I make this a simple task without having to redo all my settings? Simply backup /etc and /usr/local/etc? But is there a quick way too get a list of installed packages and reinstall them and reapply the settings?

Code:
$ gpart show
=>        40  1953525088  nda0  GPT  (932G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528     4194304     3  freebsd-swap  (2.0G)
     4728832  1948794880     4  freebsd-zfs  (929G)
  1953523712        1416        - free -  (708K)
 
Hum... It's yet the best option (thinking to the speed of the OS) unless you're ok to reinstall. Expand a file system is supported both in UFS and ZFS but shrink isn't really expected and nothing will help you in that task.

I don't mean there is no way to do this, but it's really complicated. I did that with ZFS in a specific occurrence. Nonetheless, I believe it's simpler to reinstall.
 
is there a quick way too get a list of installed packages and reinstall them and reapply the settings?

Backup /etc /usr/local/etc, run pkg prime-list > prime-list, and on the newly installed system recreate /etc /usr/local/etc, install ports-mgmt/pkg, next execute pkg install -y `cat prime-list`.

If you had a extra disk it would be very easy to import a boot environment of the old system to the new system without recreating /etc's and reinstalling packages, but that seems to be not possible.
 
Just add swap as a file. It is reliable solution for FreeBSD.
Also it is possible to add another hdd/ssd and use some partition on it as a 2nd/3rd swap.
You can on/off any swap without reboot using swapon swapoff. Use swapinfo to see current swap info.
 
How much actual data usage do you have on the system? Do you have a USB stick/drive large enough to receive it?

I would be tempted to snapshot the system, ZFS send it into an archive on a usb stick; boot off a USB installer image, repartition as desired, recreate the zpool on the smaller partition, and zfs receive the archive into it. You’ll want to also set the (zpool) bootfs property.

You also likely don’t need both the efi and freebsd-boot partitions, but you could also just leave them in place to not have to worry about reloading the bootloader.
 
Dear mca2,
now I am the next one not answering your question. Have you already tried to limit ARC? This could help to reduce the RAM requested by ZFS. In best case that would reduce the swap significantly.
 
pkg prime-list as pointed out gives a nice list of packages already installed
/etc and /usr/local/etc should have all of the "system" configuration
Of course user home directory needs to be kept.
 
Back
Top