Lets say you need a partition to be resized, this can be done quite easy if you have a running Geom Mirror.
First, you remove one drive from the mirror by running the following command:
1 |
gmirror insert gm0 /dev/ada1 |
Next you need to prepare the disk ada1 with the new partitions, you can do this by using sysinstall or check here for more info: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html.
Keep one thing in mind, if you use sysinstall. Let it point to the mount points you will create in the next step, DON’T let them point to the active mount points. Your system will become inaccessible if you will.
After you done that, mount the new partitions. I advice you to mount then within a self created structure:
1 2 3 4 5 6 7 8 9 10 |
mkdir /mymnt mkdir /mymnt/root mkdir /mymnt/tmp mkdir /mymnt/usr mkdir /mymnt/var mount /dev/ada1s1a /mymnt/root mount /dev/ada1s1e /mymnt/tmp mount /dev/ada1s1f /mymnt/usr mount /dev/ada1s1d /mymnt/var |
Now you have to copy all files from the gm0 mirror to the new partitions on ada1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
cp -a /tmp/* /mymnt/tmp/ cp -a /usr/* /mymnt/usr/ cp -a /var/* /mymnt/var/ cp -a /.cshrc /mymnt/root/ cp -a /.snap /mymnt/root/ cp -a /_system /mymnt/root/ cp -a /boot /mymnt/root/ cp -a /entropy /mymnt/root/ cp -a /home /mymnt/root/ cp -a /root /mymnt/root/ cp -a /sys /mymnt/root/ cp -a /usb /mymnt/root/ cp -a /iso /mymnt/root/ cp -a /libexec /mymnt/root/ cp -a /mnt /mymnt/root/ cp -a /bin /mymnt/root/ cp -a /compat /mymnt/root/ cp -a /dist /mymnt/root/ cp -a /etc /mymnt/root/ cp -a /lib /mymnt/root/ cp -a /media /mymnt/root/ cp -a /rescue /mymnt/root/ cp -a /sbin /mymnt/root/ cp -a /.profile /mymnt/root/ cp -a /COPYRIGHT /mymnt/root/ cp -a /dev /mymnt/root/ cp -a /proc /mymnt/root/ mkdir /mymnt/root/tmp mkdir /mymnt/root/usr mkdir /mymnt/root/var chmod 1777 /mymnt/root/tmp |
Now edit the /etc/fstab to point to /dev/ada1 instead of /dev/mirror/gm0. Then reboot and be sure you boot from ada1.
This can be chosen with F5 at the bootloader then press F1 to boot.
As last action we have to destroy the old mirror and rebuild the new one. This can be done with the following:
1 2 3 4 5 6 7 |
gmirror remove gm0 ada0 kldload geom_mirror sysctl kern.geom.debugflags=17 gmirror label -vb round-robin gm0 /dev/ada1 sed -i .orig -e 's|/dev/ada1|/dev/mirror/gm0|' /etc/fstab |
Now reboot but keep in mind that you boot from ada1!
Then insert the ada0 drive.
1 |
gmirror insert gm0 /dev/ada0 |
Wait and your done…
I’m sure there are nicer ways to do this, but for me, it worked fine.