Solved

Ghost-like mirroring tool for Sun boxes?

Posted on 2003-10-29
15
6,072 Views
Last Modified: 2013-12-27
I'm looking for (don't know if it exists) a tool similar to the Symantec Ghost product for Sun boxes?

Any suggestions or pointers would be appreciated.
0
Comment
Question by:soldato
  • 3
  • 2
  • 2
  • +7
15 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9646873
Not quite like Ghost (Ghost cann't handle Solaris). To clone a harddisk, if you have 2 identical HD, you
can use the 30 years old UNIX "dd" command to do the job.

boot up the system to single  user mode / (or use Solaris CD to boot up to single user mode).
use "format" command to find out the disk device name BUT DO NOT FORMAT the harddisk.

then use the following command:

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2

This will copy disk c0t0d0    to c0t1d0.    s2 refer to the whole HD.

If you have two different HDs, you cann't use "dd", you have to use format, ufsdump, ufsrestore to
do the job.

use "format" command to partition the new HD,
you can make it to have the same number of partions (the size of the partition can be the same, or just bigger than the data size, or bigger).

  Assume that your first HD is c0t0d0, 2nd disk is c0t2d0
(use format command to find out the names in your system).

  you can then use "ufsdump + ufsrestore" to dump the partition one by one, then make the diskbootable.

  eg: your first harddisk have /, /var, /usr, /export
      4 filesystems(partitions) refer to /etc/vfstab for details.
     
       let's say you want to dump the / filesystm to 1st partion of the 2nd HD, you do:

# mount the target partition
mount /dev/dsk/c0t0d0s0 /mnt
/usr/sbin/ufsdump 0cf - / | (cd /mnt; ufsrestore rf -)

where finish file transfer, you do:
rm /mnt/restoresymtable
umount /mnt

repeat the above procedure to cope the other partitions

Perform fsck to all the partions in the 2nd HD.

Make the 2nd HD bootable:

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk \
        /dev/rdsk/c0t2d0s0


That's it. It should work for you.
0
 
LVL 34

Expert Comment

by:PsiCop
ID: 9647746
If you're looking for the ability to "stamp out" Sun boxes using a standard config or set of configs, then what you want is Solaris Jumpstart.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9647887
U can try this software, which support many os including solaris.

http://www.availsolutions.com/
0
 
LVL 7

Expert Comment

by:glassd
ID: 9649110
In addition to the ufsdump/ufs restore method described above, I have successfully cloned live machines by copying each filesystem using cpio, and then doing the installboot thing. Cpio handles the special files better than tar can.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9649593
tar is not for system level backup, it can not handle special files (eg, device files).

ufsdump/ufsrestore is a Solaris specific backup command, it have no problem with
system level backup.

cpio can do the job as well. (system level backup, no problem)
0
 
LVL 48

Expert Comment

by:Tintin
ID: 9653470
later versions of tar do support backing up of special files.
0
 

Author Comment

by:soldato
ID: 9655332
Is Jumpstart or Avail similar to Ghost?

I'm looking to "stamp out" clones, but the "standard configuration" file solution is not really an option.  I will have a custom configured application that needs to be imaged and dropped across a dozen or so Sun boxes of the same hardware type (drives, processor, ram, etc).

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 24

Expert Comment

by:shivsa
ID: 9655365
For that i think the jumpstart with work fine.

0
 
LVL 38

Expert Comment

by:yuzh
ID: 9655675
" I will have a custom configured application that needs to be imaged and dropped across a dozen or so Sun boxes of the same hardware type (drives, processor, ram, etc)."

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2

willl do the job for you, exactly image.
0
 
LVL 6

Expert Comment

by:durindil
ID: 9657124
The closest tool to Ghost and easiest is Solaris' 'fssnap'  It allows you to take a snapshot of a filesystem, but does not require as much up front configuration as Jumpstart.  It is also easier to manage than 'dd' (although I use dd with a lot of small backups...)  

The best thing about fssnap is that you can take a snap of your base filesystem, and then a snap of a webserver, ftp server, etc.  Then, you just lay down the base filesystem (root, etc.) and then any others you want to build.
0
 
LVL 16

Accepted Solution

by:
Hanno Schröder earned 250 total points
ID: 9658399
DO NOT USE dd !

Use the ufsdump + ufsrestore (best together with fssnap) and do the installboot afterwards.
The steps required are:
1) Copy VTOC from source to target disk (or do manual formatting using "format")
2) for each filesystem, dump it using ufsdump and put it on the target disk using ufsrestore (you can connect ufsdump and ufsrestore using a pipe). If you wish you can use fssnap to read off live filesystems with ufsdump.
3) Do the installboot for the root slice on the target disk
DONE.
If you want to boot from the target disk make sure you change the moutn entries in /etc/vfstab accordingly!

Here's a small script to clone a disk using these standard UNIX tools:

#!/bin/sh

if [ "$#" != 2 ] ; then
  echo "usage: $0 sdisk tdisk"
  echo "where: sdisk is the source disk (e.g. c0t0d0)"
  echo "       tdisk is the target disk (e.g. c0t1d0)"
  echo "Note:  Please omit slice numbers!"
  exit 1
fi

format</dev/null | grep "\.[       ]$1" >/dev/null 2>&1 && S=$1
format</dev/null | grep "\.[       ]$2" >/dev/null 2>&1 && T=$2
if [ -z "$S" ] ; then
  echo "ERROR: Source disk $1 does not exist -- exit!" ; exit 2
elif [ -z "$T" ] ; then
  echo "ERROR: Target disk $2 does not exist -- exit!" ; exit 3
fi

clear ; echo "
  ATTENTION: This script will copy the whole disk $S to $T
             If this is NOT what you intended to do, abort
             by pressing Ctrl-C now!

  Are you ready now [N] ? \c"
read ans mist ; echo ""
[ "$ans" != "J" -a "$ans" != "j" -a "$ans" != "Y" -a "$ans" != "y" ] && exit 1

prtvtoc /dev/rdsk/${S}s2|fmthard -s - /dev/rdsk/${T}s2      # copy VTOC
for i in `tail -r /etc/mnttab|grep /a|awk '{print $2}'`      # make sure nothing is
  do umount -f $i >/dev/null 2>&1                  # mounted under /a ...
done
[ -d /a ] || mkdir /a                              # create /a if not here

SD=/dev/rdsk/$S ; TD=/dev/rdsk/$T                  # the raw disk devices
fs=`df -kl | grep \`echo $SD | sed -e 's/rdsk/dsk/'\` |\
    grep /dsk/ | sed -e 's/^.*\(s[0-9]* \).*/\1/'`      # fs on boot disk used

for i in $fs;do
  echo "creating file system on ${TD}$i ...\c"
  echo y | newfs ${TD}$i >/dev/null 2>&1 ; echo ""      # create filesystems
done

for i in $fs ; do                              # mount new disk under
 echo "copying all data from slice $S$i to $T$i ..."      # /a and copy all data
 M=/a`df -kl|grep ${S}$i|awk '{print $6}'|sed -e 's!/$!!'`
 F=`df -kl|grep ${S}$i|awk '{print $6}'`            # from source disk
 mount `echo ${TD}$i|sed -e 's/rdsk/dsk/'` $M            # to target disk
 ( /etc/init.d/xntpd stop ; sleep 30 ; /etc/init.d/xntpd start ) &
 ufsdump 0f - `fssnap -F ufs -o raw,bs=$M,unlink ${F}`|\
   ( cd $M ; ufsrestore rf - ) >/dev/null 2>&1            # (using ufsdump
 fssnap -F ufs -d ${F} >/dev/null 2>&1                  # with UFS snapshot)
 echo ""
done

# Okay, now let's make the new disk bootable:
installboot /usr/platform/`uname -m`/lib/fs/ufs/bootblk \
    `df -kl /a | sed -ne 's/\(\/dev\/\)\(dsk\/[^       ]*\).*/\1r\2/p'`

# and modify the mount entries in /etc/vfstab on new disk:
sed -e "s/${S}/${T}/g" /etc/vfstab > /a/etc/vfstab
0
 
LVL 16

Expert Comment

by:Hanno Schröder
ID: 9658403
P.S.: You may call the script I've just posted "ghost" if you want ;-)
0
 
LVL 2

Expert Comment

by:colsey79
ID: 9665497
Hi soldato

Solaris 8 2/02 and later has a "Ghost" like feature.  ie the ability to clone one machine and install it onto any other machine... it's called "WebStart Flash Archive".

This allows you to create an image of say a E250 and install the same image onto a SunBlade 100, or a SunFire 4800 via jumpstart, tape, CD/DVD or HTTP.  This is by far the easiest method compared to all the other detailed and it does just the job you require. IMO it does a better job than Ghost does especially as it's a fully supported option provided by the OS manufacturer :-)

You can also do a lot more with Flash archive than you can with the other methods or even Ghost and it's faster too :-) (IMO).

Check out details of "Flash Archive" at http://docs.sun.com/db/doc/816-2411/6m8ou8s8t?a=view

HTH
0
 
LVL 2

Expert Comment

by:colsey79
ID: 9665506
Oh I also forgot to mention that Flash Archive in Solaris 9 now supports "Layered Archives" as well as the ability to split and merge archives.

The possiblities are quite amazing.  Give it a try, you won't be disappointed (at least if you use Sol 9)

Oh yes, and you can also use LiveUpgrade with flash archives... this allows you to build say a Sol 9 machine, create an archive of it, then update a Sol 7 machine using LiveUpgrade with the only downtime being that of a single reboot...

HTH
0
 
LVL 1

Expert Comment

by:tskyers
ID: 11476272
Has anyone tried udpcast? I've a coworker who has definately won me over. I don't know if it is a native sloaris product, but it is quite extensible. http://www.udpcast.linux.lu/
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now