RE: Backing up freebsd to 1 file?
-Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd- questi...@freebsd.org] On Behalf Of J.D. Bronson Sent: Sunday, April 18, 2010 3:23 PM To: freebsd-questions@freebsd.org Subject: Backing up freebsd to 1 file? I have a freebsd 8.0 install and was wondering if it is possible to tar up the entire install...for backup purposes. # cd / # tar -cvf backup.tar {list of directories} then I can ftp the tar file out to another machine. This works in theory, but if I need to do a restore tar complains on 'tar -xpf backup.tar'. Under OpenBSD, this works as expected. It has given me an easy way to backup/move/restore or anything I want to do w/o complaining. I am running Freebsd on a machine that has no other drives/tapes or anything so my options for backup are limited. All I am trying to do is get a complete image (or snapshot) of my entire install on this machine and then if I needed to reload or reinstall, I could do a bare bones freebsd install, copy over the tar'd up file and extract it from within / and then reboot an I would be go to go. Thoughts on this would be appreciated... Perhaps http://ra.phid.ae/stuff/mm-backup-0.9.sh.txt has something that you like. -- Regards, T. Koeman, MTh/BSc/BPsy; Technical Monk MediaMonks B.V. (www.mediamonks.com) Please quote all replies in correspondence. smime.p7s Description: S/MIME cryptographic signature
Re: Backing up freebsd to 1 file?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19/04/2010 06:52:29, Sergio de Almeida Lenzi wrote: but I use zfs and I think that during shutdown, /etc/rc.d/zfs is called stop so it unmounts all zfs partition... (I did not tested...)... so It must be called /etc/rc.d/zfs start again... (just a few inconvenient...) That's actually a very interesting point, and as far as I can tell from looking at the rc scripts, what you describe is exactly what would happen. Now wondering how a pure-ZFS system manages going to single user. Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvL/s4ACgkQ8Mjk52CukIzoUQCfYFhoGDPr4bN3SO9PXLp6U54W 6moAn1fxKG+7Xp+76xNwzUdF6mAGxd9u =RgU6 -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
Sergio == Sergio de Almeida Lenzi lenzi.ser...@gmail.com writes: It kills everything ungracefully and will screw up anything that needs to sync state to disk -- like mysql. Just use shutdown(8): it's what it's there for. # shutdown now Going single user to make backups Cheers, Matthew Sergio Ok you are right... Sergio for me worked because I never use mysql... Sergio but I use zfs and I think that during shutdown, /etc/rc.d/zfs is Sergio called stop Sergio so it unmounts all zfs partition... (I did not tested...)... Nope. shutdown doesn't appear in /etc/rc.d/zfs keywords, so it won't get stop during normal shutdown. That must happen later. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19/04/2010 16:16:21, Randal L. Schwartz wrote: Nope. shutdown doesn't appear in /etc/rc.d/zfs keywords, so it won't get stop during normal shutdown. That must happen later. Dammit. I know this really -- but for some reason i had it in my head that the keyword was 'noshutdown' with exactly the opposite semantics. You're entirely correct. D'Oh! Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvMjroACgkQ8Mjk52CukIz1xwCfQSfxlb1f14A/dxwlemUw0rV9 gtIAmwR4rM7Xge3PlzKEW46hipRMpOhV =5SjO -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
On 18 April 2010 15:56, J.D. Bronson jd_bron...@sbcglobal.net wrote: be created by the time your system boots on. Nice answer by Sergio, but I personally would use the j option with tar to compress to bzip2; 3) tar --one-file-system -cvjf /mnt/backup.tbz ./ var usr home Though I prefer personally to use dump/restore because: - If you're on UFS, you don't have to single-user the system, just use the L option (live filesystem) - Restore has an awesome 'interactive' mode - See Zwicky [1] I'll send you my dump scripts if you're interested. It's dead easy to use! Chris [1] http://www.coredumps.de/doc/dump/zwicky/testdump.doc.html . I think Sergio has a nice script. I had been doing something similar but I know I recall when untarring (restoring if you will) it was complaining about not being able to do things. It was not sockets and similar stuff that gets rebuilt on reboot. I do not have failures handy to post (yet). Truth be told? - I am running FreeBSD hosts within ESXi. I can backup the hosts within ESXi but need to take the host offline and its a cumbersome ordeal. If I had RAID on ESXi, I wouldn't be so worried per se but this is not an option. ESXi is very fussy about what is supported and I dont have the $ for SCSI and SCSI Raid. Basically what I need to do is create a fully restorable backup for 2 reasons: 1. Easy to create another host on ESXi. I can setup/flavor my fbsd install and then once thats done, setup another host. 2. Obvious backup reasons. ...right now, if the SATA drive fails that is hosting the fbsd install I am dead in the water. I have 5 hosts on this machine spread across 4 SATA drives but nothing is mirrored or RAIDed in anyway. I am at the mercy of these drives w/o any backup- Yeah, use dump. It's excellent, and you can bz2 the results. My script for dumping: #!/bin/sh # $Id: backuphdd.sh,v 1.3 2010/02/02 13:02:06 root Exp $ # $Log: backuphdd.sh,v $ # Revision 1.3 2010/02/02 13:02:06 root # Changed so that backup/spare is only manipulated when backup level is 0 # # Revision 1.2 2009/12/22 16:13:05 root # Now uses bzip2 LEVEL=$1 mount /backup/dumps mv /backup/dumps/root_level_$LEVEL.bz2 /backup/dumps/root_level_$LEVEL.bz2.old dump -$LEVEL -Lauf - / | bzip2 /backup/dumps/root_level_$LEVEL.bz2 mv /backup/dumps/var_level_$LEVEL.bz2 /backup/dumps/var_level_$LEVEL.bz2.old dump -$LEVEL -Lauf - /var | bzip2 /backup/dumps/var_level_$LEVEL.bz2 mv /backup/dumps/usr_level_$LEVEL.bz2 /backup/dumps/usr_level_$LEVEL.bz2.old dump -$LEVEL -Lauf - /usr | bzip2 /backup/dumps/usr_level_$LEVEL.bz2 umount /backup/dumps ---end I call it from cron ~3 in the morning with a tower of hanoi rotation; it takes the argument to the script as the dump level; /root/backuphdd.sh 0 performs a level 0 dump of all the drives. Don't forget to back up _all_ your partitions! Dump only backs up separate partitions... Chris ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Backing up freebsd to 1 file?
I have a freebsd 8.0 install and was wondering if it is possible to tar up the entire install...for backup purposes. # cd / # tar -cvf backup.tar {list of directories} then I can ftp the tar file out to another machine. This works in theory, but if I need to do a restore tar complains on 'tar -xpf backup.tar'. Under OpenBSD, this works as expected. It has given me an easy way to backup/move/restore or anything I want to do w/o complaining. I am running Freebsd on a machine that has no other drives/tapes or anything so my options for backup are limited. All I am trying to do is get a complete image (or snapshot) of my entire install on this machine and then if I needed to reload or reinstall, I could do a bare bones freebsd install, copy over the tar'd up file and extract it from within / and then reboot an I would be go to go. Thoughts on this would be appreciated... -- J.D. Bronson ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
On Sun, 18 Apr 2010 08:23:12 -0500, J.D. Bronson jd_bron...@sbcglobal.net wrote: I have a freebsd 8.0 install and was wondering if it is possible to tar up the entire install...for backup purposes. # cd / # tar -cvf backup.tar {list of directories} then I can ftp the tar file out to another machine. This works in theory, but if I need to do a restore tar complains on 'tar -xpf backup.tar'. In this case, you're better using dump partition-wise, or just use dd to copy the whole disk - this may lead to large files, so adding compression is often useful. Under OpenBSD, this works as expected. It has given me an easy way to backup/move/restore or anything I want to do w/o complaining. What exact complains are output by FreeBSD's tar? I am running Freebsd on a machine that has no other drives/tapes or anything so my options for backup are limited. Note that dumping / restoring (especially restoring) is more easy to be done by booting from a live system (e. g. via CD, DVD or USB). All I am trying to do is get a complete image (or snapshot) of my entire install on this machine and then if I needed to reload or reinstall, I could do a bare bones freebsd install, copy over the tar'd up file and extract it from within / and then reboot an I would be go to go. Well... tar is not so good suited for that. There are things at file system level that are important to the system, but are not honored by the tar utility. In this case, dump + restore provide excellent means for what you're intending. In case of a failure, use a FreeBSD boot medium with sysinstall or sade to prepare the disk (slice, partition, newfs), then restore the dump files to the partitions, reboot, and it's done. Of course, dd provides an exact 1:1 copy, and you can choose to copy partitions, slices, or a whole disk. The dump and restore programs operate on file systems (partitions), while tar operates on files. Thoughts on this would be appreciated... There are some threads in the archives about how to backup or clone a whole system. You'll find some more inspirations and considerations there. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
I am very happy with the folowing Supose that you have mount ANOTHER device on /mnt 1) mount /dev/ /mnt 2) init 1 (this closes all applications and drop into single user) 3) tar --one-file-system -cvzf /mnt/backup.tar.gz ./ var usr home 4) umount /mnt 5) exit (reboot from single user to normal operation) === on restore... supose you install a FBSD minimal from the CD/usb. 1) mount /dev/ /mnt 2) tar -xpvf /mnt/backup.tar.gz -C / 3) umount /mnt ===you have restored your system= may be some files (sockets...) are not restored but no problem as they will be created by the time your system boots on. Sergio ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
you can migrate to zfs and then create snapshot of whole disk, import this snapshot (e.g. via ssh) and then restore it back. Good luck. -- Jan Hlodan On Sun, Apr 18, 2010 at 3:23 PM, J.D. Bronson jd_bron...@sbcglobal.net wrote: I have a freebsd 8.0 install and was wondering if it is possible to tar up the entire install...for backup purposes. # cd / # tar -cvf backup.tar {list of directories} then I can ftp the tar file out to another machine. This works in theory, but if I need to do a restore tar complains on 'tar -xpf backup.tar'. Under OpenBSD, this works as expected. It has given me an easy way to backup/move/restore or anything I want to do w/o complaining. I am running Freebsd on a machine that has no other drives/tapes or anything so my options for backup are limited. All I am trying to do is get a complete image (or snapshot) of my entire install on this machine and then if I needed to reload or reinstall, I could do a bare bones freebsd install, copy over the tar'd up file and extract it from within / and then reboot an I would be go to go. Thoughts on this would be appreciated... -- J.D. Bronson ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org 5 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
On 18 April 2010 15:37, Sergio de Almeida Lenzi lenzi.ser...@gmail.com wrote: I am very happy with the folowing Supose that you have mount ANOTHER device on /mnt 1) mount /dev/ /mnt 2) init 1 (this closes all applications and drop into single user) 3) tar --one-file-system -cvzf /mnt/backup.tar.gz ./ var usr home 4) umount /mnt 5) exit (reboot from single user to normal operation) === on restore... supose you install a FBSD minimal from the CD/usb. 1) mount /dev/ /mnt 2) tar -xpvf /mnt/backup.tar.gz -C / 3) umount /mnt ===you have restored your system= may be some files (sockets...) are not restored but no problem as they will be created by the time your system boots on. Nice answer by Sergio, but I personally would use the j option with tar to compress to bzip2; 3) tar --one-file-system -cvjf /mnt/backup.tbz ./ var usr home Though I prefer personally to use dump/restore because: - If you're on UFS, you don't have to single-user the system, just use the L option (live filesystem) - Restore has an awesome 'interactive' mode - See Zwicky [1] I'll send you my dump scripts if you're interested. It's dead easy to use! Chris [1] http://www.coredumps.de/doc/dump/zwicky/testdump.doc.html ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
be created by the time your system boots on. Nice answer by Sergio, but I personally would use the j option with tar to compress to bzip2; 3) tar --one-file-system -cvjf /mnt/backup.tbz ./ var usr home Though I prefer personally to use dump/restore because: - If you're on UFS, you don't have to single-user the system, just use the L option (live filesystem) - Restore has an awesome 'interactive' mode - See Zwicky [1] I'll send you my dump scripts if you're interested. It's dead easy to use! Chris [1] http://www.coredumps.de/doc/dump/zwicky/testdump.doc.html . I think Sergio has a nice script. I had been doing something similar but I know I recall when untarring (restoring if you will) it was complaining about not being able to do things. It was not sockets and similar stuff that gets rebuilt on reboot. I do not have failures handy to post (yet). Truth be told? - I am running FreeBSD hosts within ESXi. I can backup the hosts within ESXi but need to take the host offline and its a cumbersome ordeal. If I had RAID on ESXi, I wouldn't be so worried per se but this is not an option. ESXi is very fussy about what is supported and I dont have the $ for SCSI and SCSI Raid. Basically what I need to do is create a fully restorable backup for 2 reasons: 1. Easy to create another host on ESXi. I can setup/flavor my fbsd install and then once thats done, setup another host. 2. Obvious backup reasons. ...right now, if the SATA drive fails that is hosting the fbsd install I am dead in the water. I have 5 hosts on this machine spread across 4 SATA drives but nothing is mirrored or RAIDed in anyway. I am at the mercy of these drives w/o any backup- -- J.D. Bronson ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18/04/2010 15:37:03, Sergio de Almeida Lenzi wrote: 2) init 1 (this closes all applications and drop into single user) It kills everything ungracefully and will screw up anything that needs to sync state to disk -- like mysql. Just use shutdown(8): it's what it's there for. # shutdown now Going single user to make backups Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvLJY4ACgkQ8Mjk52CukIwq8QCfcu48NVNcs1SOsbtV+rZ98MeR hWkAniPX6+bOIx0ej3CXpT8gzNiKBUB/ =hQW3 -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18/04/2010 15:19:32, Jan Hlodan wrote: you can migrate to zfs and then create snapshot of whole disk, import this snapshot (e.g. via ssh) and then restore it back. You can create snapshots with UFS too. It's a good way of getting a reasonably consistent backup without having to shut the whole system down. Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvLJgMACgkQ8Mjk52CukIzreQCeJBZYMx2Zi1QGq0K76mUD39/x /LgAnAx44eaGLZjNP9eOg9HyOyeR7CYO =/mZk -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
On Sun, 18 Apr 2010, J.D. Bronson wrote: I have a freebsd 8.0 install and was wondering if it is possible to tar up the entire install...for backup purposes. # cd / # tar -cvf backup.tar {list of directories} then I can ftp the tar file out to another machine. This works in theory, but if I need to do a restore tar complains on 'tar -xpf backup.tar'. As others have mentioned, tar is not well suited for this. Under OpenBSD, this works as expected. It has given me an easy way to backup/move/restore or anything I want to do w/o complaining. I am running Freebsd on a machine that has no other drives/tapes or anything so my options for backup are limited. All I am trying to do is get a complete image (or snapshot) of my entire install on this machine and then if I needed to reload or reinstall, I could do a bare bones freebsd install, copy over the tar'd up file and extract it from within / and then reboot an I would be go to go. If you don't have any other drives, where will the backup file be stored so it survives a system failure or reinstall? Thoughts on this would be appreciated... dump/restore is the standard safe way; you can send it over ssh to back up to a file on another machine. Sometimes people use dd, which can be effective if you use some tricks like filling unused space with zero so compression is effective. There's another option. I've mentioned clonezilla.org here before as a way to back up Windows systems; it's fast and only copies used sectors. Newer beta versions of clonezilla now support UFS directly, so they can back up FreeBSD disks. This is nice because it also backs up the MBR, and splits the backup files into 2G increments. It may also be faster than dump/restore. Note that I only noticed the UFS mode lately and have only tried it once so far, so no real experience on how safe it is yet. -Warren Block * Rapid City, South Dakota USA ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
On 4/18/10 10:39 AM, Warren Block wrote: If you don't have any other drives, where will the backup file be stored so it survives a system failure or reinstall? Thoughts on this would be appreciated... dump/restore is the standard safe way; you can send it over ssh to back up to a file on another machine. Sometimes people use dd, which can be effective if you use some tricks like filling unused space with zero so compression is effective. There's another option. I've mentioned clonezilla.org here before as a way to back up Windows systems; it's fast and only copies used sectors. I would sftp/scp the file over to another unix (or windows via samba) machine I have. Then burn the resulting file to DVD RW media. -- J.D. Bronson ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Backing up freebsd to 1 file?
It kills everything ungracefully and will screw up anything that needs to sync state to disk -- like mysql. Just use shutdown(8): it's what it's there for. # shutdown now Going single user to make backups Cheers, Matthew Ok you are right... for me worked because I never use mysql... but I use zfs and I think that during shutdown, /etc/rc.d/zfs is called stop so it unmounts all zfs partition... (I did not tested...)... so It must be called /etc/rc.d/zfs start again... (just a few inconvenient...) Thanks for the tip Sergio ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org