Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get disks, directories, applications 1

Status
Not open for further replies.

rvarman

IS-IT--Management
Apr 24, 2003
91
FR
Hi,
i'm new to unix.
i would like to list
- the number of disks present
- see if raid present
- the different directories
- the apllications installed
etc..
i have one tape present in my sun blade.
Is it possible to backup the whole system and restore in case of system crash (by diaster recovery).
i've no backup logiciel.

Your suggestions please.
 
The answers to your questions:

the number of disks present - Run the command format, it will show you the number of disks.

see if raid present - Which application are you running for Volume Management?

the different directories - Not sure what you want here but typically ls -aF will give you a list of your directory by placing a * next to it. The command ls -la will show you the same with the exception that it will show you directories by list a d in first field on the left.

the apllications installed - You can run admintool and go to software packages or use the command pkginfo

 
Nice,
i've 2 disks but i d'ont know if there are in raid.
In case of system crash and without raid how can i get back my system.
i've one tape drive and there is a cron job to backup certain directories by tar.
waht are the different methods possible for diaster recovery.
i can' execute admintool, it syas "can't open display"

Thanks fou your suggestions.
 
See /etc/vfstab for what type of filesystems are getting mounted.

If you see /dev/vx path for the devices you have the Veritas volume manager and you will also find the FS type like VxFS or UFS.

If you see /dev/md path, you have Disksuite.

If you have Veritas, run vxprint -hrt for more info.

If you have disksuite, run metastat.

Thanks,
Chandu.


 
To show disks without going through a menu

format </dev/null

Disksuite volume management

/usr/sbin/metastat

If command is not found or replies &quot;there are no existing databases&quot;, you are not using Disksuite.

Veritas Volume management

/usr/sbin/vxprint

If command not found or no disks reported you are not using Veritas.

Assuming you are just using normal filesystems (not raw database devices) your best bet for a simple backup is to use ufsdump. This backs up at the filesystem (mountpoint) level and allows you to either recover whole filesystems at a time or use a menu system to recover selected files you may have deleted accidentally.

There are plenty of scripts out there to do ufsdump backups - you need to loop through each mounted filesystem and use the no-rewind tape device (/dev/rmt/0n) which prevents the files from overwriting each other. Ufsdump can also be used to perform incremental dumps so you can save tape by for instance performing a full dump at the weekend and an incremental every weekday. Full dump example for all mounted filesystems..

#!/usr/bin/ksh
mt -f /dev/rmt/0 rewind
for FILESYSTEM in `df -Fufs | cut -d' ' -f1`
do
echo &quot;Saving $FILESYSTEM&quot;
ufsdump -0uf /dev/rmt/0n $FILESYSTEM
done
mt -f /dev/rmt/0 rewind


To restore the complete system you would need to boot from cdrom into single user mode -'boot cdrom -s'. Use the format menu to reformat your drives, call newfs to make the filesystems and for each one mount it onto the spare /mnt directory then restore your ufsdump..

e.g. for root

newfs /dev/rdsk/c0t0d0s0
mount -Fufs /dev/rdsk/c0t0d0s0 /mnt
cd /mnt
ufsrestore -xf /dev/rmt/0n

You will need to keep a record of the tapes used and the order the filesystems on the tape. The script below will output the mountpoints and the disk layouts.

#!/usr/bin/ksh
echo &quot;Vfstab for `uname -n`&quot;
grep -v '^#' /etc/vfstab
for DISK in `format </dev/null | grep cyl | awk '{ print $2 }'`
do
echo
echo $DISK Layout
format -d $DISK <<EOF 2>/dev/null | egrep 'wm|wu'
p
p
q
EOF
done
 
The admintool command must be run on the console, not via a telnet connection.
 
To look at your disks without using format use the format command use the following:
for i in `ls /dev/dsk/c?t?d0s2`; do prtvtoc -s $i; done

To get disk &quot;BLOCK&quot; size information use:

df -g

To see directory structure you could use something like:
du -do / # maybe redirect to a file to see the structure of the root partition

Good Luck,
Laurie.
 
You can run admintool in a telnet session if you are using a terminal emulator like Reflection or Exceed. You have to type the following before you can run admintool (or disksuite, for that matter):

for ksh:
export DISPLAY=<the IP address of your desktop system>:0.0

for sh:
DISPLAY=<the IP address of your desktop system>:0.0
export DISPLAY

Instead of the IP address of your desktop system, you can also just put in the name of your PC, followed by the :0.0.
 
as julianbarnett said,
i've normal UFS filesystem.
i think of using his script to backup all mount points.
i tried yesterday ufsdump but when it is finished after 2 hours, it didn't come out.
i had to use ctrl-C to exit.
is it normal or have i to include an exit statement in the script.

Ufsrestore :
in case of system crash, is it possible to get back my compete system?
i've oracle and Broadvision installed in my server.
by restoring mountpoints, will the applications be reinstalled?
Thanks four your help.

i've to consider also hostdump proposed by mikeclark .
 
For a realy simplistic backup script use this:

#!/bin/ksh
#
# NAME: Weeklybackup.sh
# TASK: To do level 0 backup
# CODE: Laurie Baker for Otleyweb.co.uk
#
# To Rewind the tape ->
# uncomment this next line
# mt -f /dev/rmt/0 rewind
#
# Back up the local disks /, /var, /usr .... comments just for ref
#
#
# Set-up the lists of volumes to backup
#
UFSDUMPLISTLOCAL=&quot;/ /usr /var /export/home /opt /usr/openwin&quot;

VXDUMPLISTLOCAL=&quot;&quot;


LOCALMACH=localhost
DUMPLOG=`date '+%d%b%Y'`
DUMPLOG=&quot;/backups/dumplog$DUMPLOG.log&quot;
cat /dev/null > $DUMPLOG

echo &quot; ¬¬¬ CAUTION! ¬¬¬&quot;
echo &quot; ****** SYSTEM BACKUP IN PROCESS ******&quot;
echo &quot;+++++++ Otleyweb.Co.Uk +++++++&quot;

for i in `echo $UFSDUMPLISTLOCAL`
do
echo &quot;****** $i ******&quot;
/usr/sbin/ufsdump 0fcu /dev/rmt/0cn $i >> $DUMPLOG 2>&1
done

#
# Backup the shared disks
#
for i in `echo $VXDUMPLISTLOCAL`
do
echo &quot;****** $i ******&quot;
/usr/sbin/vxdump -0fcus /dev/rmt/0cn 87040 $i >> $DUMPLOG 2>&1
done

#
# Backup the other local disks
#
# for i in /etc/opt/SUNWcluster/conf/ccdssa
# do
# echo &quot;****** $i ******&quot;
# /usr/sbin/ufsdump 0fcu /dev/rmt/0cn $i >> $DUMPLOG 2>&1
# done


Simple or what?

Good Luck
Laurie.
 
You shouldn't have needed to ^C out. The tape would not have ejected at the end, just rewound. If you want it to eject as well change the last line to 'mt -f /dev/rmt/0 rewoffl'.

Laurie is correct in that you should use 0cn or 0un to get get hardware compression working. If you have a script that has a hardcoded list of partitions to back up you need to remember to add to it whenever you add extra slices. Probably better to generate the list automatically from df -F ufs & df -F vxfs and hardcode an exclusion list for partitions you don't want to back up.

e.g.
EXCLUSIONS=&quot;/sparefs|/rawdbvol&quot;
UFSFS=`df -Fufs | egrep -v $EXCLUSIONS | cut -d' ' -f1`
for FILESYSTEM in $UFSFS
do
...etc

Yes you can get the entire system back as long as you are not using raw partitions for your database devices. If you are you would normally do a database dump to a filesystem file before your tape backup is scheduled. This enables you to recover the database executables, reinitialise your raw devices and logs and then restore the latest dump file back. Even if you are using filesystem devices for Oracle I believe you would need put shut down your database or put it into hot dump (not sure of the terminology) mode before you back up the filesystems it uses. But this is more a question for the Oracle DBA forum.
 
ufsdump works fine.
but i can't read my tape.
when i use tar tvf /dev/rmt/o, it says &quot;tape read error&quot;.
awiting your suggestions please!!!!
 
You have &quot;ufsdumped&quot; your contents (disk slices) onto tape to see what's on the tape you need to use &quot;ufsrestore&quot; NOT tar.

Use something like this (cut from one of my process documents) BUT MISS OUT THE &quot;add & extract&quot;:

mt rewind
ufsrestore –ifs /dev/rmt/0n 1

what (description of archive)
ls (list of files on tape)
add .* (this should select all files on the tape. ls again afterward and note ‘*’ next to files added.)
extract (this will write tape files to current directory)
type “1” for next volume (default answer for popup question)
quit (tape will then be positioned for next partition set)

cd ../(second mountpoint on tape etc)

ufsrestore –ifs /dev/rmt/0n 1 (again)


A HINT:- To jump to 3rd partition on tape :-

mt rewind
mt –f /dev/rmt/0n fsf 2

I hope this helps?

Good Luck,
Laurie.




 
laurie,

i've tried ufsrestore with all options but i see no output comming.
ufsrestore ifs /dev/rmt/o
ufsrestore tvf
etc

i'm sure that ufsdump works fine.
i see dumping of the 3 mountings finish with &quot;Dump is done&quot;.

thanks for your further comments.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top