DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th August 2008
milo974 milo974 is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 58
Thanked 0 Times in 0 Posts
Unhappy backup drive to image file

Hello, i want to backup drive ( there's openbsd 4.3 with postfix config, mails) to an image file one time a week. I ve mounted my nt share in : /nt_1
i want to backup the image to /nt_1/backupOpenBSD.img

How can i do that as simply as possible ? using dump ? dd ? cp ?

Last edited by milo974; 11th August 2008 at 06:54 AM. Reason: more precision
Reply With Quote
  #2   (View Single Post)  
Old 11th August 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,883
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by milo974 View Post
How can i do that as simply as possible ?
dump(8) & restore(8) are your safest bets. You should also look at recommendations in Section 14.9 as well:

http://openbsd.org/faq/faq14.html#Backup
Reply With Quote
  #3   (View Single Post)  
Old 11th August 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,688
Thanked 214 Times in 189 Posts
Default

If you want to back up an "image" of the complete physical drive as a single entity, then dd(1) of the "c" partition is needed. This will back up every block on disk, used or unused.

If you want to back up individual FFS partitions for possible restoration on OpenBSD, dump(8) is recommended. If you intend on restoring to non-OpenBSD environments, tar(1), cpio(1), and pax(1) all have various capabilities. There's also the gtar package, which is the GNU implementation of tar(1).
Reply With Quote
  #4   (View Single Post)  
Old 13th August 2008
milo974 milo974 is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 58
Thanked 0 Times in 0 Posts
Default

Hello,
Thank's to your ans, i want only backup my openbsd partition to a file : /nt_1/myopenbsd.img ?? i need to use dd ? How can i achieve my goal please ?
Thank's.

Last edited by milo974; 13th August 2008 at 07:43 AM. Reason: more precisions
Reply With Quote
  #5   (View Single Post)  
Old 13th August 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,688
Thanked 214 Times in 189 Posts
Default

Here is one possibility, which assumes the hard drive you want to replicate is wd0. Note that I chose to use the raw (character) device, as I have found this is usually faster than cooked (buffered) device for this sort of thing.

If the number of sectors are evenly divisible by some blocksize, you can increase the speed of replication by using the "bs=" operand. Read the dd(1) man page.

# dd if=/dev/rwd0c of=/nt_1/myopenbsd.img

Here is another method, where the output is piped through a compression step:

# dd if=/dev/rwd0c | gzip > /nt_1/myopenbsd.img.gz
Reply With Quote
  #6   (View Single Post)  
Old 13th August 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,688
Thanked 214 Times in 189 Posts
Default

Two thoughts:

  1. Since this is a network connected drive (Sharity-light or Samba) you may have filesize limitations. If so, you could use split(1) to divide your image into multiple files in the destination filesystem. e.g.:

    # mkdir -p /nt_1/myopenbsd_image# cd /nt_1/myopenbsd_image# dd if=/dev/rwd0c | gzip | split -b 1024m image.gz
  2. How will you restore your image to the disk?
Reply With Quote
  #7   (View Single Post)  
Old 14th August 2008
milo974 milo974 is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 58
Thanked 0 Times in 0 Posts
Default

i ve tried dd to backup rwd0, i saw it copied not only the system and datas but the entire partition so it takes a long time, and it is very big!
I only want to backup the partition (only system, datas, nothing else) like Norton ghost can do... Is there a way to do that ?

What i want : backup openbsd+datas to restore on an over hard disk and boot on.
Reply With Quote
  #8   (View Single Post)  
Old 14th August 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,688
Thanked 214 Times in 189 Posts
Default

As I mentioned above, and as you should have learned during installation .... the "c" partition is the entire hard drive.

As I mentioned above, dd(1) copies every sector, regardless what is in it. So if you are using dd to back up a 250GB hard drive, the output of the dd command will be 250GB.

As mentioned several times to you, the standard practice is to use tools which back up individual filesystems. Several were already mentioned: dump/restore, tar, cpio, and pax. Specifically for OpenBSD, dump/restore is most often recommended -- tar is handy for small hierarchies but is usually unable to backup complex directory structures due to filename size limitations.

For disaster recovery, the ramdisk kernel (bsd.rd) booted from installation media is typically used -- all of the built-in tools mentioned are included with that kernel. One would recreate and restore all filesystems -- if your system uses daily(8), you will find your disklabels in /var/backups, so you might restore /var first to acquire them. Note that restore(8) requires some space in /tmp, so if using bsd.rd, you will need to mount /tmp before running restore.

Installing boot blocks is done with installboot(8).
Reply With Quote
  #9   (View Single Post)  
Old 14th August 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,883
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by milo974 View Post
i ve tried dd to backup rwd0, i saw it copied not only the system and datas but the entire partition...
Backing up rwd0 will back up all partitions which reside on the disk. You may want to study the output of mount(8) (specifying no options...) to determine what partitions exist. At a minimum, you have one partition which houses the entire filesystem. The upper limit of partitions disklabel(8) can address on a single drive is 16.
Quote:
I only want to backup the partition (only system, datas, nothing else) like Norton ghost can do... Is there a way to do that ?
It sounds like you are looking for a pre-canned solution. Although there is a g4u project which was started by a big proponent of NetBSD, note that this was never ported to OpenBSD so it is not clear whether it ever reached production system quality.
Quote:
What i want : backup openbsd+datas to restore on an over hard disk and boot on.
Why do you want to repeatedly backup the system? Why not simply back up the data itself? This will take far less space & time. Again, consider the well tested solution of dump(8) & restore(8) as has been mentioned before. tar(1) is another possibility.

Lastly, it sounds like you are in a mixed shop of OpenBSD & Windows, hence your question about Ghost. You will be helping yourself by becoming familiar with the way Unix/OpenBSD treat disks. Taking the time to study Section 14 of the FAQ will have benefits down the road:

http://openbsd.org/faq/faq14.html
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP read file contents - Maximum file size cksraj Programming 1 21st September 2009 11:38 AM
backup freeBSD 7.0 using Backup Exec ccc FreeBSD General 2 25th April 2009 09:23 PM
Backup to USB flash drive giga FreeBSD General 5 8th December 2008 11:06 PM
Image Titles JMJ_coder Feedback and Suggestions 4 1st July 2008 05:40 AM
How to make an image from a DVD PatrickBaer FreeBSD General 11 25th May 2008 11:48 AM


All times are GMT. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick