Other Backup full system

I have 128GB HDD on my HP proliant, it is running in raid 1(2x sas).
But my bitcoind server is using most of it and I get messages that the drives are full.

So I bought 2 500GB sas drives. I want to run the 4 drives in raid 1+0.
But I don't want to lose my system because it will take a long time to set it up again.

How can I make a backup of the full system and easily put it back on the new disks?
 
I assume, we are talking about UFS2 filesystems. In that case, full system cloning is done in two general steps.

1. Partitioning the target using gpart(8)

For this, I usually execute as user root the following sequence, where adaX is the device identifier of the new disk (!!! verify !!!):
gpart destroy -F adaX
gpart add -s 128 -a 4k -t freebsd-boot adaX
gpart add -s 4G -a 4k -t freebsd-swap -l SWAP adaX (Note: if you need more swap space then use 8G or 16G, instead of 4G)
gpart add -a 4k -t freebsd-ufs -l SYSTEM adaX

Place the boodcode:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 adaX

Set the bootme attribute:
gpart set -a bootme -i 3 adaX

Set the entire disk active in order the disk can be recognized by some too restrictive BIOS:
gpart set -a active /dev/adaX

Create the UFS2 filesystem:
newfs -j /dev/adaXp3
tunefs -a enable /dev/adaXp3


2. Clone the content of the filesystem(s) to the new SYSTEM partition

Mount the new SYSTEM partition:
mount -o noatime /dev/adaXp3 /mnt

Clone the root partition of the current disk to the new SYSTEM (/dev/adaXp3) partition. The SWAP partition must not be cloned. In general, I use the tool sysutils/clone from the ports. Others like more net/rsync or sysutils/cpdup, here I show the use of clone(1):
pkg install clone
clone -x .snap:.sujournal / /mnt

Note, before FreeBSD 9, the standard partition scheme placed /tmp, /usr and /var on separate partitions/slices. If this is your case, then you need to clone these slice as well (!!! verify before executing the following !!!)

clone -x .snap:.sujournal /usr /mnt/usr
clone -x .snap:.sujournal /var /mnt/var
mkdir -p -m 1777 /mnt/tmp

Finally you need to adjust the file /etc/fstab on the new SYSTEM partition, so it matches the partition labels as set in the gpart commands above, for example:
nano /mnt/etc/fstab
Code:
# Device          Mountpoint  FStype    Options        Dump    Pass#
/dev/gpt/SWAP     none        swap      sw             0       0
/dev/gpt/SYSTEM   /           ufs       rw,noatime     0       1

Finally unmont the new SYSTEM disk from its temporary mount location:
cd
umount /mnt

Power down the computer shutdown -p now, and replace the old startup disk by the new one.
 
I want to point out a technical aspect you want to consider. Two different disk sizes is not good for RAID1+0.
Ideally you would want 4 identical drives.
In your arrangement you would end up with 4 drives at 128GB each for RAID10. You would lose the rest of the space of your 500GB drives.
Migrating back your filesystem to the new array would be tough. I would use a temporary disk.
 
Back
Top