Contents:
- Overview of the Basic Method
- Information You Need Before Starting
- Example Instructions to Set Up a Basic JumpStart Boot
- Prepare Your Client's OpenBoot PROM Environment
- Boot Up the Client From JumpStart
- An Alternative Method to Boot Your Client From a Solaris Boot CD-ROM
- Whichever Method You Booted From, Prepare the Client Environment
- Enable Your Client to Share Disk Partitions Using NFS
- Determine the Real Disk Name
- Reformat Your Disks
- Mount the First File System on
/tmp/disk
, Share It Out With NFS, and Mount It Onto the Media Server - Restore the Operating System From VERITAS NetBackup Software
- Disable Any Disk Mirroring Before Rebooting
- Make the Disk Bootable
- About the Author
Overview of the Basic Method
The situation is that you need to restore the Solaris Operating System on your client's server system disk for whatever reason, and I assume that you are unable to boot normally from the Solaris system. I also assume that you have a backup of your client's operating system on VERITAS NetBackup.
You are going to boot your client up from CD-ROM or JumpStart, and use NFS to share the disk partitions out, then mount them on a NetBackup Media Server, and restore your operating system files into the Media Server mount point. This will effectively restore the operating system onto your client's system disk.
Note that by default it is not possible to share partitions natively through NFS when booting from CD-ROM or JumpStart.
You can choose either method to boot up, but in any case it is probably useful to follow the steps for preparing the OpenBoot PROM (OBP) environment.
Information You Need Before Starting
You will need to have this information on hand:
- The IP and subnet mask of the client system you are going to rebuild
- The client's MAC address
- The interface card that connects to the subnet from which you will boot using the JumpStart server
- The IP address of the JumpStart server
- The partitions that each of the client's file systems resided on and the partition size
- The IP of the VERITAS NetBackup Media Server from which you are going to restore
- The address of the router on the client's subnet that will allow the client to reach the NetBackup Media Server (if it is on a different subnet)
For the purposes of this document, the JumpStart server's IP is 10.0.0.1 and the client has an IP of 10.0.0.2, and a subnet mask of 255.255.255.0. The NetBackup Media Server's IP is 10.1.1.1.
Example Instructions to Set Up a Basic JumpStart Boot
You can skip this step if you are booting from a CD-ROM.
I assume here that if you boot from JumpStart, the server has a router address that allows your client to reach the NetBackup Media Server. If that is not the case, see the section on booting from a CD-ROM for the commands to set up routing: An Alternative Method to Boot Your Client From a Solaris Boot CD-ROM.
On the JumpStart server, edit the /etc/ethers
file so it contains the MAC address of your client's system. (The MAC address is displayed with the banner
command from the OBP on the client.)
Next, edit the /etc/hosts
file so that it contains the client's host name and its IP. (The client's IP is the same subnet as the JumpStart server and should be on the backup LAN network.)
Then go to the tools
directory of the JumpStart client and run the add_install_client
command, as in the following example:
# cd /jumpstart/solaris8/february2002/Solaris_8/Tools
# ./add_install_client client_1 sun4u
Important note: You must share the NFS JumpStart files from the JumpStart server as read only, ( -o ro
), or the JumpStart configuration will become corrupted. For more details, please see the SunSolve document SRDB ID: 22979 (editor's note: available to registered SunSolve users with a valid Sun Service Plan).
Thus:
share -F nfs -o ro,anon=0 /jumpstart
Prepare Your Client's Open Boot PROM Environment
From the OBP, you need to know which interface you will boot from, and create an alias to its hardware path. If needed, you can run the following commands to see which interfaces are connected to something at the other end:
OK watch-net-all
To display any current aliases for network devices, use OK devalias
.
To set up a network device alias name (for the interface on the JumpStart backup LAN) do the following:
OK show-nets
This lists the interfaces. Select the one you want (for example, b
).
OK nvalias jump-nic ctrl+y
This creates the alias called jump-nic
. (ctrl + y
pastes in the interface you selected.)
At this stage you need to make sure your chosen interface will use the MAC that you got from the banner command.
OK printenv use-local-mac-address?
If it shows as true
, change it to false
. (You can change it back after the restore.)
OK setenv use-local-mac-address? false
Next, I recommend setting auto-boot?
to false
in case you have problems:
OK setenv auto-boot? false
Boot Up the Client From JumpStart
Use OK boot jump-nic -s
or OK boot net -s
, and wait for the #
prompt.
An Alternative Method to Boot Your Client From a Solaris Boot CD-ROM
Use
OK boot cdrom -s
and wait for the #
prompt. If you booted from a CD-ROM, on the client, run the commands necessary to configure the appropriate IP, netmask, and routing.
# ifconfig hme0 plumb 10.0.0.2 up netmask 255.255.255.0 broadcast +
If your media server is on a different network, add a route in (according to the following example). Here, 10.0.0.254
is the router that you can use to reach the media server, with the destination as the IP address of 10.1.1.1
.
# route add net 10.1.1.1 10.0.0.254 1
Whichever Method You Booted From, Prepare the Client Environment
On the client, type the following commands:
# stty erase ^H
# exec ksh -o vi
# PS1='$PWD> '
# export TERM=vt100
I am assuming you have connected to your client through some sort of remote console, and it needs vt100
rather than sun
as a terminal type.
If your client is connected to a switch that is set to run at 100 Mbit/sec full duplex, you can change the duplex to be full, thus massively speeding up your restore time.
If you have a more modern interface such as bge or ce, you will need to check the Sun documentation for the syntax to use.
Determine the name of your interface with the following:# ifconfig -a
At this stage you should check that the subnet mask of your interface is correct. This is picked up from the subnet used for the same network range in /etc/netmasks
on the JumpStart server.
If you look closely you will see that the broadcast address is probably wrong (it may or may not affect the network connection), so you should correct it. Here is an example:
# ifconfig hme0 broadcast +
This command determines the broadcast for you and corrects it on the fly.
Next, create and run a script similar to the one shown next. Modify the instance
and dev name
to suit your system. If you are using bge interfaces you will need to refer to other documentation, as a different syntax is used.
# vi /tmp/ndd
Add the following lines. (Note: This example is for the hme
interface, hme0
. hme1
would be used for instance 1, and so on.)
ndd -set /dev/hme instance 0
ndd -set /dev/hme adv_100T4_cap 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0
ndd -set /dev/hme adv_10hdx_cap 0
ndd -set /dev/hme adv_autoneg_cap 0
# chmod 744 /tmp/ndd
# /tmp/ndd
Enable Your Client to Share Disk Partitions Using NFS
You are going to make the /etc/dfs
directory writable so that you can use NFS on the client to share out the disk partitions.
# cd /etc
# find dfs | cpio -pdumv /tmp
# mount -F lofs /tmp/dfs /etc/dfs
# cd /etc/init.d
# ./rpc start
# ./nfs.client start
# vi /etc/dfs/dfstab
Next, in the /etc/dfs/dfstab
file, put in a line similar to the following:
share -F nfs -o rw,anon=0 -d "client restore" /tmp/disk
Note that in this case it is READ / WRITE ( -o rw )
, as you want to use NFS to share the disk partition to which you are going to restore.
Now that the dfs
directory is mounted in the writeable swap file system (/tmp
on your client), dfstab
and sharetab
are writeable files. This allows you to share disk partitions from your client using NFS, even though the directory is read only by default when the client is booted from CD-ROM or JumpStart. Note: The boot directory on the JumpStart server is actually /
(root) on your client.
In the /tmp
directory, create the mount point you will share your disk partitions from:
# mkdir /tmp/disk
# cd /etc/init.d
# ./nfs.server start
# unshareall
The next step is very important. You will determine the real disk name of the root disk to which you are restoring.
Determine the Real Disk Name
Important note: If you are restoring a system with multiple disk controllers, when you boot from JumpStart or a CD-ROM, the controllers will almost certainly be probed in a different order than they would be probed when booting normally from UNIX. As a result, the controller names will be different. For example, c2t0d0
, when booted from JumpStart, could refer to c1t0d0
booted from UNIX. To get the real device name, you need to issue the devalias
command from the OK
prompt. This will display the hardware path of the boot device and you can compare it to the output of the format
command.
Here is an example:
1. While booted from JumpStart, issue the appropriate break signal (stop+A
, or the equivalent, according to your connection type) to go to the ok
prompt.
2. devalias
shows something like the following:
rootdisk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@0,0
rootmirror /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
3. format
would show the following when booted to full UNIX:
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf7f2c6f,0
1. c1t1d0
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf8febe7,0
This is what format
shows when booted from the JumpStart server:
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@8,700000/scsi@2/sd@0,0
1. c1t1d0
/pci@8,700000/scsi@2/sd@1,0
2. c1t2d0
/pci@8,700000/scsi@2/sd@2,0
3. c1t3d0
/pci@8,700000/scsi@2/sd@3,0
4. c1t4d0
/pci@8,700000/scsi@2/sd@4,0
5. c2t0d0
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf7f2c6f,0
6. c2t1d0
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf8febe7,0
4. Under JumpStart, the root disk you need to restore to is c2t0d0
.
Because you are using fibre-attached internal disks, this example does not show you everything you need to know. Although the devalias
controller path matches the format
controller path, it does not very effectively translate Fibre WWNs to the device ID name of devalias
output. However, it should be obvious that under a JumpStart boot, disk@0,0
and disk@0,1
relate to c2t0d0
and c2t1d0
, respectively. (Note that I did not show c2t1d0
in the preceding JumpStart format
printout.)
Reformat Your Disks
Now use the format program to reformat your disk using the same partition sizes as the original system had, or use suitable alternative sizes.
Also, note that if you had your root disk mirrored under VERITAS Volume Manager, and you are restoring to the original system disk, due to the way VERITAS repartitions the disk, you will definitely have to reformat the original disk and reinstate VERITAS mirroring later on.
When you have reformatted the disk, create file systems on it.
# for i in 0 3 4 5
do
echo y | newfs /dev/rdsk/c0t0d0s$i
done
Mount the First File System on /tmp/disk
, Share It Out With NFS, and Mount It Onto the Media Server
# mount -F ufs /dev/dsk/c0t0d0s0 /tmp/disk
# shareall
Now log on to the VERITAS NetBackup Media Server as root, and mount the client's NFS share on it.
# cd /tmp
# mkdir client_1
(The host name of your client)
# mount -F nfs 10.0.0.2:/tmp/disk /tmp/client_1
# ls -ail /tmp/client_1
Check that you can see a lost+found
directory to confirm that you have actually mounted the remote share.
Restore the Operating System From VERITAS NetBackup Software
Very important note: On all versions of the VERITAS NetBackup software, when you are restoring files there will be an option to rename hard and soft links
. You must select rename hard links
and deselect rename soft links
. If you get these options wrong, you will lose absolute path symbolic links and your restore will be invalid.
From your machine, using Exceed or some other XWindows client, log onto the NetBackup master server as root. Then do the following (where ip:0
is your machine's IP address):
# cd /usr/openv/netbackup/bin
# export DISPLAY=your_pc's_ip:0
Note: Using start
, run
, cmd
, and typing ipconfig
will display your machine's IP.
If you are restoring from VERITAS NetBackup version 3.4, I suggest using the xnb
interface to run your commands.
# ./xnb&
However, the following example is for VERITAS NetBackup 4.5. Please note that if you are using VERITAS NetBackup 3.4, you need to make selections that will achieve equivalent results to the example I have given for version 4.5.
For VERITAS NetBackup version 4.5, I recommend using the jnbSA
interface:
# ./jnbSA&
Log in to the GUI as root and enter the root password when prompted.
Make the Initial Selections and List the Backup You Are Going to Restore
- In the left pane, click
backup restore and archive
. Then, in the right pane, select therestore
tab and click on the hand symbol, located at the top right side of the window. - On the
netbackup server
tab, highlight the master server you need and clickmake current
. (Note: If needed, type in the server name, then clickadd
.) - On the
source client
tab, do the same to select the name of the client backup that you are going to restore, clickadd
, type in the client name, highlight it, and selectmake current
. - On the
destination
tab, repeat the previous steps to select the media server where you have mounted the NFS share of the client's root file system. Clickokay
to exit back to the previous window. - Now that you are back in the previous window, click the dropdown arrow, and select
normal backup
. Next clickbrowse directory
and type in the directory you need to restore. (The first time around, the directory will be/
.) - On the far right of the
browse directory
there are some icons. Hover the mouse over the icons to see their names, if needed. You will probably only need to click the icon forshow most recent backups
. - Click the
refresh
icon to display your results. This should list all the files from the most recent full (and possibly differential) backup for your client.
Select Files and Restore Them
1. First, deselect any previous file selections by removing any checks. Then select the appropriate directory by checking the box in the directory structure pane
window. (You will select either /
, /var
, /home
, or whatever other partitions or mount points you have, according to the partition you are currently restoring.)
2. Now click the restore
button at the bottom right side of the display. Select restore to a different location
. If needed, type /
as the source directory. (In later steps this would be /var
or /home
.) In the destination directory
, type in your mount point on the media server, for example, /tmp/client_1
.
Note that when restoring /var
, the source directory would be /var
and the destination directory will remain /tmp/client_1
.
Very important note: As stated previously, on all versions of the VERITAS NetBackup software, when you are restoring files there will be an option to rename hard and soft links
. You must select rename hard links
and deselect rename soft links
. If you get these options wrong, you will lose absolute path symbolic links and your restore will be invalid.
3. Now select restore directories without crossing mount points
and make sure that overwrite existing files
has not been selected.
4. Click start restore
and select yes
to view progress.
Unmount and Unshare File Systems to Prepare for the Next Cycle
- When the restore is finished, unmount the file system on the media server.
- Go back to the client
client_1-bu
and do the following:# unshareall
# umount /tmp/disk
# umount /tmp/ client_1
Repeat
Now go back and repeat the following three steps:
- Mount the next partition on
/tmp/disk
on the client. Again typeshareall
. Then go to the media server and NFS mount the client share again. Here is an example: - Work through the "Select the Files and Restore Them" section again.
- Work through the "Unmount and Unshare File Systems to Prepare for the Next Cycle" section again.
# mount -F ufs /dev/dsk/c0t0d0s3 /tmp/disk
# shareall
Repeat this process for the appropriate slices until you have restored all the file systems required.
After all restores are completed, make the disk bootable.
Working From the Restored Client
After the process is completed, you need to install the boot block to make the disk bootable. To do so, mount slice 0
onto /tmp/disk
again.
Now run the following command (and note that broken line should be all on one line when you type it):
/tmp/disk/usr/sbin/installboot
/tmp/disk/usr/platform/`uname -i`/lib/fs/ufs/bootblk \
dev/rdsk/c0t0d0s0
Disable Any Disk Mirroring Before Rebooting
While the root partition is still mounted, before rebooting the client you need to disable the disk mirroring (such as mirroring with Solstice DiskSuite software). However, the following example is for unmirroring a disk mirrored with VERITAS Volume Manager.
Consult your Sun documentation if your disk was mirrored with Solstice DiskSuite.
Type the following command:
# cd /tmp/disk/etc
# vi system
Comment out all occurrences of the following two lines:
rootdev:/pseudo/vxio@0:0
set vxio:vol_rootdev_is_volume=1
Type the following:
# vi vfstab
Change it so that all VxVM volumes are commented out and the O/S
slices are referred to by their native dsk
and rdsk
device names. This usually can be accomplished with the following:
# cp vfstab vfstab.vx
# cp vfstab.prevm vfstab
Note: It is assumed that you have laid out your disk partitions for the restore in the same way they were laid out when the system was originally built. If this is not the case, edit the file and adjust any mount points as needed.
Run the following:
# cd vx/reconfig.d/state.d
# rm *
# touch install-db
Make the Disk Bootable
Unmount all disk slices and run fsck -y
on them to ensure the sanity of the file systems.
# for i in 0 3 4 5
do
fsck -y /dev/rdsk/c0t0d0s$i
done
Shut down the client and boot up.
# halt
Then, from the OBP, type:
boot
After booting up from your successfully restored system, reinstate the disk mirroring as appropriate, and carry out any other work as necessary, such as copying additional mount entries to /etc/vfstab
from the original vfstab.vx
file.
About the Author
Brad Webb is a contractor based in the U.K., with 16 years of experience in the IT industry. He currently works as a Solaris and UNIX Systems Administrator, and in the past has worked for various companies in permanent roles, including UNIX Systems Administrator, Hardware Analyst, and Field Service Engineer.
http://www.sun.com/bigadmin/content/submitted/restore_netbackup.html
0 comments:
Post a Comment