I have found all kinds of backups to tape (anyone still using tape?). But I would like to backup my da0 to a usb drive. Is this posible? And will it make a perfect copy? One that I can restore and go from.
Mark
Mark
# bsdlabel -B -w da0s1
# bsdlabel -B -w da0p1
# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/da0p2 4G 372M 3.3G 10% /
devfs 1.0k 1.0k 0B 100% /dev
/dev/da0p5 4G 306M 3.3G 8% /var
/dev/da0p6 2G 16M 1.8G 1% /tmp
/dev/da0p7 92G 6.5G 78G 8% /usr
zpool0 15G 31k 15G 0% /zpool0
zpool1 399G 31k 399G 0% /zpool1
/dev/md0 19M 24k 17M 0% /tmp
#!/bin/sh
# This script will use dump command to backup your running
# system to a USB flash stick.
# This is run as root.
#
# Change these device unit pre-fixs in the code below as needed
# ad0 is the live file system
# da0 is the target
#
# Comment or uncomment the 4 dump statements depending on
# whether you want to compress the saved dump file.
#
# Be sure to unplug your USB stick and re-plug it in to
# mount it again.
echo " "
echo " "
echo "Starting time for this live file system dump is"
date
echo " "
echo " "
echo "Prepare the target"
dd if=/dev/zero of=/dev/da0 count=4
fdisk -BI /dev/da0
bsdlabel -B -w da0s1
newfs -U /dev/da0s1a
mount /dev/da0s1a /mnt
cd /mnt
echo " "
echo " "
echo "Post the dump date"
date > date.of.dump
cat date.of.dump
echo " "
echo " "
echo "Post the MBR"
dd if=/dev/ad0 count=1 > MBR
#dd if=/dev/ad0 count=1 | od -c
echo " "
echo " "
echo "Collect live Slice Partition sizes and save"
bsdlabel ad0s1 > liveSPsizes
cat liveSPsizes
echo " "
echo " "
echo "Collect live file system sizes and save"
df -h > liveFSsizes
cat liveFSsizes
echo " "
echo " "
echo "Post the fstab"
cp /etc/fstab > fstab
cat /etc/fstab
echo " "
echo " "
echo "Post the script used to create this dump"
cp /root/bin/fbsd2backup > fbsd2backup
echo " "
echo " "
echo "Post the script used to restore this dump"
cp /root/bin/fbsd2restore > fbsd2restore
echo " "
echo " "
echo "Dump file system 'a' / "
dump -0Lauf dump0-root /dev/ad0s1a
#dump -0Lauf dump0-root /dev/ad0s1a | gzip
echo " "
echo " "
echo "Dump file system 'd' /var "
dump -0Lauf dump0-var /dev/ad0s1d
#dump -0Lauf dump0-var /dev/ad0s1d | gzip
echo " "
echo " "
echo "Dump file system 'e' /tmp "
dump -0Lauf dump0-tmp /dev/ad0s1e
#dump -0Lauf dump0-tmp /dev/ad0s1e | gzip
echo " "
echo " "
echo "Dump file system 'f' /usr "
dump -0Lauf dump0-usr /dev/ad0s1f
#dump -0Lauf dump0-usr /dev/ad0s1f | gzip
sync
cd /root
umount /mnt
echo " "
echo " "
echo "Ending time for this live file system dump is"
date
echo " "
echo " "
echo "Script completed"
echo " "
echo " "
echo "Unplug your USB stick NOW"Disaster Recovery:
night said:My original question was for a total backup. In windows it is very easy to do. From all the reply's I get in here. It seems that you have to have a phd in scripting to get it done.
A little farther down the thread you will notice that I am reformatting and installing about four times a day trying to get things right. A total install would make things so much easier.
I'm not so sure now that the speed of the file system of BSD. Makes up for the steep learning curve.
Mark
night said:Is there no CMD that will backup a drive no matter what is on it?
Mark