Nekochan Net

Official Chat Channel: #nekochan // irc.nekochan.net
It is currently Mon Nov 24, 2014 6:52 am

All times are UTC - 8 hours [ DST ]


Forum rules


Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.



Post new topic Reply to topic  [ 55 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
Unread postPosted: Thu Jan 05, 2006 5:19 am 
Offline
User avatar

Joined: Sat Mar 20, 2004 6:23 am
Posts: 589
Location: The Netherlands
Happy new year everyone :D

I found this small tut ( yes, another one... ) on how to clone a rootdrive.
The good part is and I don't know if this is new ( it was for me ) is that you don't have to have disks of the same size.... :wink:


Code:
Cloning A Root Disk
Sometimes, it's necessary to make an exact copy of a disk, perhaps for backup purposes or perhaps during an OS upgrade, eg. a single client machine has a new OS installed and its disk is then cloned to all other client disks before individual changes are made. This is a very good way of ensuring that all client systems have identical software setups and is alot faster than installing products manually on each machine. The procedure itself is easy, so if you're someone who has dozens of systems to configure, then don't panic! The info here should help. Note that SGI's TechPubs site has further information.
There are two main ways to clone a disk: using xfsdump in conjunction with xfsrestore, or by using the tar command. The xfsdump method is listed first as it's faster and has other advantages. Sometimes though, the xfsdump method is not appropriate, in which case tar is used - example scenarios are explained later. xfsdump is just better at handling device files, etc. whereas tar can cause problems if not used properly.
In the description given here, I'm assuming certain things:
The disk to be cloned is a root (system) disk on SCSI ID 1 on controller 0. Cloning option disks is a very similar process - specifics connected with this are given later.
The disk to be copied onto is installed as SCSI ID 2 on controller 0.
The file system type on both disks is XFS (if your source file system is EFS, then use the tar method given later).
Bootup the system and login as root. Obtain a UNIX shell.
Create a mount point:
  mkdir /0
Use fx to repartition the extra disk (don't include my comments):
  cd
  fx -x                             # Run fx
  <Enter>                           # Select dksc
  <Enter>                           # Select controller 0
  2                                 # Select drive 2
  <Enter>                           # Select lun 0
  r                                 # Select repartition option
  ro                                # Select root drive option
  <Enter>                           # Select XFS
  yes                               # Yes, continue with the operation
  ..                                # Return to the main menu
  l                                 # Create a new label
  sy                                # Write out the new label
  /exit                             # Exit fx
Use mkfs to create a new file system:
  mkfs -b size=512 /dev/dsk/dks0d2s0
Note that if the disk is 4GB or larger, then exclude the block size definition, ie. just enter:
  mkfs /dev/dsk/dks0d2s0
Mount the destination disk:
  mount /dev/dsk/dks0d2s0 /0
Confirm the amount of space available with 'df -k'.
Now begin the copy process:
  cd /0
  xfsdump -l 0 -p 5 - / | xfsrestore - .
This specifies a Level 0 dump (all files), progress report every 5 seconds, acting on the root file system. xfsdump sends the data to the standard output (by the use of the '-' character); this is piped to xfsrestore which is getting its data from the standard input (again by the use of the '-' character).
NB: I often find it useful to know how long these copy procedures take, eg. planning whether or not one has enough time to do multiple systems, etc. Thus, I always use the timex command to report how long the copy process lasted. Just put timex as the first command, ie. instead of the above, enter:
  cd /0
  timex xfsdump -l 0 -p 5 - / | xfsrestore - .
It doesn't make any difference to the copy process, but it can be useful to have a appreciation for how long these tasks take.
Tip 1: if you're doing all this in a standard xterm, make it wider so that the progress messages don't get wrapped onto the next line. It's easier to read.
Tip 2: if you're using a multi-CPU system, remember you can use the runon command to force the copy process to run on a particular CPU. It's best to choose a CPU that's closest to the SCSI controller(s) involved in the copy process as this minimises system traffic. This is more relevant to newer systems such as Origin, Onyx2, etc. On older systems like Onyx and Challenge, it's more useful simply as a way to prevent the default CPU 0 being used to do everything, eg. for a 4-CPU deskside one might run the task on CPU 3 thus:
  cd /0
  runon 3 timex xfsdump -l 0 -p 5 - / | xfsrestore - .
Finally, the volume header information from the root disk must be copied onto the target disk, though one could do this while the copying is going on. Enter the following:
  cd /stand
  dvhtool -v get sash sash /dev/rdsk/dks0d1vh
  dvhtool -v get ide ide /dev/rdsk/dks0d1vh
  dvhtool -v creat sash sash /dev/rdsk/dks0d2vh
  dvhtool -v creat ide ide /dev/rdsk/dks0d2vh
There may be a symmon entry in the volume header too, in which case enter these extra commands:
  dvhtool -v get symmon symmon /dev/rdsk/dks0d1vh
  dvhtool -v create symmon symmon /dev/rdsk/dks0d2vh
Try the 'get symmon' command above; if it gives a not-found error, then there isn't any symmon entry present, so don't bother with the creat command.
Alternatively, one can copy the volume header interactively, which does have the advantage of being able to see exactly what is present in the volume header. Also, some systems will have other entries besides sash, ide and symmon, eg. O2 will often have a file called IP30prom. Thus, the interactive method is what I usually use. Here is what to enter (exclude my comments of course):
  cd /stand
  dvhtool /dev/rdsk/dks0d1vh      # Access the system disk volume header
  vd                              # Switch to a different menu
  l                               # List contents of volume header
  g sash sash                     # Copy volume header entries to disk;
  g ide ide                       # If the 'l' command shows other entries
  g symmon symmon                 # besides these, then copy them too.
  quit                            # Exit from this session...
  quit
  dvhtool /dev/rdsk/dks0d2vh      # Access the destination disk
  vd
  l
  d sash                          # Delete old entries (if any are shown
  d ide                           # to be present by the l command),
  d symmon                        # including any besides, sash, ide and symmon.
  a sash sash                     # Copy new entries to destination volume header...
  a ide ide
  a symmon symmon
  quit
  write                           # Confirm out the changes
  quit
In fact, the amount of typing required for the interactive method is less, so that's another advantage.
Note that 5.3 handles the sash in a slightly different way from 6.2/6.5, so if the disk to be copied is a 5.3 installation, then the volume header copy operation can be compacted to:
  cd /0
  dvhtool -v creat /stand/sash sash /dev/rdsk/dks0d2vh
And that's it! The machine can now be powered down and the cloned disk removed. Don't forget to change the clone disk's SCSI ID to 1, though on many systems that is done automatically via the use of a disk sled.
Most of the time, using xfsdump is the best, fastest and most efficient way to clone a disk. However, sometimes it may not be appropriate, eg. if the file system spans several disks but the destination is just a single disk (xfsdump only dumps a single named file system). In such circumstances, using tar is the main alternative.
However, using tar requires some special measures: all NFS mounts should be unmounted beforehand, as should the /proc file system. Also, any CDROMs and other media should be ejected from their respective devices.
Here is what to enter after the fx/mkfs procedure, making the /0 mount point and mounting the target disk:
  umount /proc
  tar cvBpf - . | (cd /0; tar xBpf -)
This command recursively copies the root disk or file system onto the extra disk. By recursive I mean that it also copies /0 into /0; however, at the time this is done, the only items in /0 are some hidden files (because the copy process hasn't yet alphabetically reached anything else), so not much extraneous data is copied. This is why I use /0 as a mount point: if the extra disk was mounted on /disk2 and there was a directory such as /Data or /Alias containing alot of data, then alot of unnecessary copying would occur, and the copy procedure might even fail due to running out of disk space. The character '0' comes before just about everything else in the ASCII character set, so these problems ar prevented.
Note that one definitely does not want to try and tar over /proc since /proc does not contain 'real' files - the entries in /proc relate to process information, used, for example, by the 'ps' command and 'killall'. The entries appear as very large files even though they're not; they are effectively images of running processes; tar cannot understand this and chokes on them, so one should unmount /proc before beginning the tar procedure.
Anyway, after the tar process has finished, enter the following to remount /proc and remove the unwanted '0' directory that's inside /0:
  /etc/mntproc
  cd /0
  /bin/rm -rf 0
Using tar does have the advantage that one can see the files being copied, which is good feedback on the copying process. However, as the various necessary commands demonstrate, tar is sensitive to issues such as NFS mounts, /proc, mounted removeable media, etc. After the cloning has finished, copy over the volume header information just as for the xfsdump method.


I haven't tried this yet but I will very soon when I replace my 9GB rootdrive of my Octane2 to a 181GB drive ( thanks to the keeper :wink: )

_________________
I can feel it, my mind is going ....


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Jan 05, 2006 6:47 am 
Offline
User avatar

Joined: Wed Dec 07, 2005 5:46 pm
Posts: 729
Location: Overmere, Belgium
Nice! I was already fearing I'd have to reinstall *again* ... this will come in very handy, thanks ;)

_________________
while (!asleep()) sheep++;


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Jan 05, 2006 9:01 am 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
that's no problem at all.
i've posted a script several times some time ago. just use the search :wink:

_________________
r-a-c.de


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Jan 05, 2006 1:24 pm 
Offline
User avatar

Joined: Sat Mar 20, 2004 6:23 am
Posts: 589
Location: The Netherlands
O.K. foetz I found your script here it is ( again... ) :

Code:
#!/sbin/ksh.93
#
#  auto xfs root disk duplicating
#  IRIX 6.2 or higher
#  26.04.2000 by R-A-C
#

export orig=$1
export target=$2

if [[ $# ! = 2 ]]; then
   print 'usage: scriptname (original disk id like 1) (target disk id)'
   print ''
   print 'example: clone 1 3'
   print ''
   exit 1
else

print ''
print '... formatting disk ...'
print ''
mkfs /dev/rdsk/dks0d${target}s0

print ''
print '... mounting disk ...'
print ''
mkdir /tmp_dsk
mount /dev/dsk/dks0d${target}s0 /tmp_dsk

print ''
print '... duplicating data content ...'
print ''
cd /tmp_dsk
xfsdump -l 0 - / | xfsrestore - .

print ''
print '... making boot stuff ...'
print ''
cd /stand
dvhtool -v get sash sash /dev/rdsk/dks0d${orig}vh
dvhtool -v get ide ide /dev/rdsk/dks0d${orig}vh
dvhtool -v creat sash sash /dev/rdsk/dks0d${target}vh
dvhtool -v creat ide ide /dev/rdsk/dks0d${target}vh

print ''
print '... unmounting ...'
print ''
cd /
umount /tmp_dsk && \
sleep 1
rm -rf /tmp_dsk

print ''
print '... done ...'
print ''

fi
exit 0

You mentioned something about changing the shell and that workstations don't have IDE, here are your exact words :
foetz wrote:
remember to replace the shell and that non workstations don't have ide.


What is it that needs to be replaced and what's the IDE caveat?

_________________
I can feel it, my mind is going ....


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Jan 05, 2006 3:31 pm 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
ka0s wrote:
O.K. foetz I found your script here it is:
You mentioned something about changing the shell and that workstations don't have IDE, here are your exact words :
foetz wrote:
remember to replace the shell and that non workstations don't have ide.


What is it that needs to be replaced and what's the IDE caveat?


i'm used to name ksh after it's version so the original ksh from 1988 is ksh.88 and the newer one from 1993 is ksh.93.
so in the first line you can replace ksh.93 with just ksh to be on the safe side.

ide is the diag tool from the prom. it's started if you choose the test after starting the machine.
anyhow this binary called 'ide' is only for workstations so if you have something bigger you won't find it anywhere -> just delete the 2 lines regarding ide.

_________________
r-a-c.de


Top
 Profile  
 
 Post subject:
Unread postPosted: Fri Jan 06, 2006 8:09 am 
Offline
User avatar

Joined: Sat Mar 20, 2004 6:23 am
Posts: 589
Location: The Netherlands
O.K. got it :!:
Thanks foetz

_________________
I can feel it, my mind is going ....


Top
 Profile  
 
 Post subject:
Unread postPosted: Fri Jan 06, 2006 12:33 pm 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
ka0s wrote:
O.K. got it :!:
Thanks foetz


:D

_________________
r-a-c.de


Top
 Profile  
 
 Post subject:
Unread postPosted: Sat Jan 07, 2006 2:07 am 
Offline

Joined: Sat Mar 29, 2003 12:44 pm
Posts: 784
Location: Germany -> UK -> Germany...
before starting the whole thing or letting a script run through, use dvhtool to check the actual contents of the volume header. my octane has an additional entry called IP30prom that wasn't copied over using the script -> non-bootable clone that left me wondering until i found out.


Top
 Profile  
 
 Post subject:
Unread postPosted: Sat Jan 07, 2006 4:00 am 
Offline
User avatar

Joined: Sat Mar 20, 2004 6:23 am
Posts: 589
Location: The Netherlands
Besides the fact that GIJoe does have a point there,
I haven't been able to run the script.
I get this error :
Code:
syntax error at line 11 : `!' unexpected


I'm sure that I must be doing something wrong... so any help is most welcome :?

_________________
I can feel it, my mind is going ....


Top
 Profile  
 
 Post subject:
Unread postPosted: Sat Jan 07, 2006 7:51 am 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
GIJoe wrote:
before starting the whole thing or letting a script run through, use dvhtool to check the actual contents of the volume header. my octane has an additional entry called IP30prom that wasn't copied over using the script -> non-bootable clone that left me wondering until i found out.


IP30prom.bin is the firmware. it's not needed to boot.

_________________
r-a-c.de


Top
 Profile  
 
 Post subject:
Unread postPosted: Sat Jan 07, 2006 7:53 am 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
ka0s wrote:
Besides the fact that GIJoe does have a point there,
I haven't been able to run the script.
I get this error :
Code:
syntax error at line 11 : `!' unexpected


I'm sure that I must be doing something wrong... so any help is most welcome :?


ah, funny i didn't notice :D
of course the space is wrong between '!' and '=' so here's the corrected version:

Code:
#!/sbin/ksh.93
#
#  auto xfs root disk duplicating
#  IRIX 6.2 or higher
#  26.04.2000 by R-A-C
#

export orig=$1
export target=$2

if [[ $# != 2 ]]; then
   print 'usage: scriptname (original disk id like 1) (target disk id)'
   print ''
   print 'example: clone 1 3'
   print ''
   exit 1
else

print ''
print '... formatting disk ...'
print ''
mkfs /dev/rdsk/dks0d${target}s0

print ''
print '... mounting disk ...'
print ''
mkdir /tmp_dsk
mount /dev/dsk/dks0d${target}s0 /tmp_dsk

print ''
print '... duplicating data content ...'
print ''
cd /tmp_dsk
xfsdump -l 0 - / | xfsrestore - .

print ''
print '... making boot stuff ...'
print ''
cd /stand
dvhtool -v get sash sash /dev/rdsk/dks0d${orig}vh
dvhtool -v get ide ide /dev/rdsk/dks0d${orig}vh
dvhtool -v creat sash sash /dev/rdsk/dks0d${target}vh
dvhtool -v creat ide ide /dev/rdsk/dks0d${target}vh

print ''
print '... unmounting ...'
print ''
cd /
umount /tmp_dsk && \
sleep 1
rm -rf /tmp_dsk

print ''
print '... done ...'
print ''

fi
exit 0

_________________
r-a-c.de


Top
 Profile  
 
 Post subject:
Unread postPosted: Mon Jan 09, 2006 3:09 am 
Offline
User avatar

Joined: Sat Mar 20, 2004 6:23 am
Posts: 589
Location: The Netherlands
GIJoe wrote:
non-bootable clone that left me wondering until i found out.


Uhrr... I seem to have the same problem as GIJoe.
The drive script states that it completed succesfully but the drive is nonbootable :cry:

Does anyone have any idea how I can fix this, cause doing a complete reinstall would give me nightmares..... :?

_________________
I can feel it, my mind is going ....


Top
 Profile  
 
 Post subject:
Unread postPosted: Mon Jan 09, 2006 4:19 am 
Offline

Joined: Sat Mar 29, 2003 12:44 pm
Posts: 784
Location: Germany -> UK -> Germany...
what about mounting the disk and copying over the ip30prom or any other additional contents of the volume header from your bootable system disk?


Top
 Profile  
 
 Post subject: Foetz's Clones...
Unread postPosted: Mon Jan 09, 2006 4:56 am 
Offline
User avatar

Joined: Tue Oct 21, 2003 2:07 am
Posts: 4226
Location: Rosario / Santa Fe / República Argentina
ka0s wrote:
GIJoe wrote:
non-bootable clone that left me wondering until i found out.


Uhrr... I seem to have the same problem as GIJoe.
The drive script states that it completed succesfully but the drive is nonbootable :cry:

Does anyone have any idea how I can fix this, cause doing a complete reinstall would give me nightmares..... :?


Do you have already formatted the drive first as [root] disk using 'fx'? ...Because I think the Foetz's script will not work properly if the drive is not properly formated as [root]. Just my suggestion.
Good luck!
Cheers! ;)

_________________
Oh!, let me write that!

https://www.facebook.com/GeekTronix
https://geekli.st/GeekTronixShop
https://www.rebelmouse.com/GeekTronixShop/
http://twitter.com/GeekTronixShop
http://www.youtube.com/GeekTronixStream


Top
 Profile  
 
 Post subject: Re: Foetz's Clones...
Unread postPosted: Mon Jan 09, 2006 12:01 pm 
Offline
User avatar

Joined: Mon Apr 14, 2003 4:34 am
Posts: 5286
GeneratriX wrote:
ka0s wrote:
GIJoe wrote:
non-bootable clone that left me wondering until i found out.


Uhrr... I seem to have the same problem as GIJoe.
The drive script states that it completed succesfully but the drive is nonbootable :cry:

Does anyone have any idea how I can fix this, cause doing a complete reinstall would give me nightmares..... :?


Do you have already formatted the drive first as [root] disk using 'fx'? ...Because I think the Foetz's script will not work properly if the drive is not properly formated as [root]. Just my suggestion.
Good luck!
Cheers! ;)


of course, the drive has to be made a rootdrive via fx BEFORE using the script :!:
anyway ip30prom is the firmware and definitely not needed to boot.

_________________
r-a-c.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 55 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group