LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 09-15-2007, 08:59 AM   #1
manoj.linux
Member
 
Registered: Aug 2007
Posts: 284

Rep: Reputation: 17
Question ufsdump


Hi,

I want to how to take backup of File system From Disk to Disk using ufsdump?

Wheather we can take the backup of root file system from one disk to another if tape drive is not available? wheather it is reliable to restore root file system?
 
Old 09-15-2007, 10:26 AM   #2
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
I would give a guarded yes.

In theory, Sun always warns that you should take a server down to single user to run ufsdump on the root file system. In practice, very few sysadmins are able to take their servers down for regular backup.

What version of Solaris are you on? I'm on Solaris 9, and I use fssnap to take a system snapshot before using ufsdump. The snapshot has to be on a different partition. You still want your system to be as quiescent as possible. In principle, you can still have situations where a file is active at the point of the fssnap and is not in a consistent state. In practice, if you are doing this in the middle of the night or when the system is not too active, it seems to be pretty rare that problems occur.

Do a man on fssnap. What you want is something like:

# WHICHSNAP=`/usr/lib/fs/ufs/fssnap -o raw,bs=/usr/local/snapshot,unlink /`
# /usr/lib/fs/ufs/ufsdump 0ufN - /dev/rdsk/c0t0d0s0 ${WHICHSNAP} \
> | (cd ${MOUNTDIR} && /usr/lib/fs/ufs/ufsrestore -rf - )
# /usr/lib/fs/ufs/fssnap -d /

Note the command line continuation on the ufsdump piped to ufsrestore, and you'll have to assign a value or subsitute something for MOUNTDIR.

Of course, you want to read the man pages and fit all of this to your own situation.

I've assumed that c0t0d0s0 is your root partition. It might not be. I've also assumed you have another disk available that has c0t1d0s0 available and in the same size.

The location /usr/local/snapshot is just an arbitrary place where I put the snapshot. It has to be on another partition from / and have adequate space. Adequate space depends on file system activity. It might use very little, or if something large gets changed while you are doing the ufsfump, then that large thing has to be copied to the snapshot before it gets changed.

One serious caveat is that there is an issue between fssnap and real time modules (like xntpd). fssnap will fail if there are any running. So you will need to stop them before taking the snapshot, and then restart them after the snapshot is taken. You don't need to keep them off during the ufsdump. It is only during the moment of taking the snapshot.

Although it is slightly complex and not exactly to your point, there is a wrapper I wrote for Amanda backups so that I could use fssnap with ufsdump in my Solaris backups with Amanda: http://wiki.zmanda.com/index.php/Bac...yk.27s_Example. There are a number of details on this spelled out in the writeup there.

There is also a "cold mirror" script (user submitted) on Sun's Bigadmin site that I've used in the past. If you have a system with 2 identical drives and want to mirror them, you can use that script. It could probably use some updating. But it also probably works. Just now I wasn't able to find it again, but I'll post it in a separate reply.

Last edited by choogendyk; 09-15-2007 at 10:28 AM.
 
Old 09-15-2007, 10:34 AM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Here is the mirror script. You may need to modify it to adapt it to your system. It doesn't use fssnap. Run it off cron in the middle of the night and it probably won't matter too much. I used to run this once a week. I also used a daily script to do incrementals just of a home directory where things might change.

Note the installboot line. That's important if you are actually wanting to be able to boot off the mirrored disk in a crisis.

Code:
#!/bin/sh
# Original Script written by Constantin Ionescu
# Modified by Carlo Cosolo
# Modified by Peter Baer Galvin
# Modified by John West
# Use and distribute freely
# acquired from Sun BigAdmin June 2004, choogendyk
# fixed and adapted to our systems June 2004, choogendyk

# Define variables for use in the script
# ! Important, these must be set correctly !

# The root disk to duplicate (leave off slice numbers and path)
SRC=c0t0d0

# The empty disk to duplicate it to (leave off slice numbers and path)
DEST=c0t8d0

# The directory to mount destination partitions on while duplicating
MOUNTDIR=/mirror

# file name for this script, to rename it on $DEST and avoid execution
SCRIPT=/.backup/bin/mirror

# The slices that should be copied
SLICES="s0 s3 s4 s5 s6 s7"

echo ====================================
echo Disk Copy script started `date`
echo

# Make sure the mount point for duplicate partitions exists
if [ ! -d $MOUNTDIR ]; then
   mkdir $MOUNTDIR
   chmod 700 $MOUNTDIR
fi

# Partition the duplicate disk, make filesystems, make it bootable
prtvtoc /dev/rdsk/${SRC}s2 > /tmp/vtoc
fmthard -s /tmp/vtoc /dev/rdsk/${DEST}s2
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0
rm /tmp/vtoc

# Modify the following loop to handle any special cases
for fs in $SLICES
do
   newfs /dev/dsk/${DEST}${fs};
#  newfs /dev/dsk/${DEST}${fs} < /dev/null;
   mount /dev/dsk/${DEST}${fs} ${MOUNTDIR};
   ufsdump 0f - /dev/dsk/${SRC}${fs} | (cd ${MOUNTDIR}; ufsrestore rf -);
   if [ $fs = "s0" ]; then
     sed "s/${SRC}/${DEST}/g" /etc/vfstab > ${MOUNTDIR}/etc/vfstab;
   fi
   if [ $fs = "s7" ]; then
     mv ${MOUNTDIR}${SCRIPT} ${MOUNTDIR}${SCRIPT}.DONTRUN;
   fi
   umount ${MOUNTDIR}
done
cp /dev/null /export/home/.backup/mirror-timestamp

echo
echo Disk Copy script ended `date`
echo ====================================
echo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ufsdump linuxtesting2 Solaris / OpenSolaris 7 06-16-2006 10:23 AM
The ufsdump command Gins Linux - General 3 08-22-2005 07:16 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 02:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration