Install Netbackup7.0 on Centos5.5
- Details
- Category: Backup Systems
- Written by Mahdi Bahmani Ciahmard
- Hits: 108
1.Configure Repository
cd /etc/yum.repos.d
wget -c http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm
yum update
2.Installing NetBackup
Masterserver
[root@bksrvg ESD_NB_7.0_LinuxR_x86_64_FA]#yum install compat-libstdc++-296 xinetd libXp
[root@bksrvg ESD_NB_7.0_LinuxR_x86_64_FA]# setenforce 0
setenforce: SELinux is disabled
[root@bksrvg ESD_NB_7.0_LinuxR_x86_64_FA]# ./install
[root@bksrvg ~]# sh /usr/openv/netbackup/logs/mklogdir
[root@bksrvg ~]# cat /usr/openv/netbackup/bp.conf
SERVER = bksrvg
SERVER = mediag
SERVER = mediaau
SERVER = gmed2
CLIENT_NAME = bksrvg
USE_VXSS = PROHIBITED
VXSS_SERVICE_TYPE = INTEGRITYANDCONFIDENTIALITY
EMMSERVER = bksrvg
VXDBMS_NB_DATA = /usr/openv/db/data
OPS_CENTER_SERVER_NAME = 172.20.21.32
MEDIA_SERVER = mediag.gbgnetwork.net
MEDIA_SERVER = mediaau.gbgnetwork.net
MEDIA_SERVER = gmed2.gbgnetwork.net
RE_READ_INTERVAL = 600
MPX_RESTORE_DELAY = 60
SERVER_CONNECT_TIMEOUT = 60
CLIENT_CONNECT_TIMEOUT = 600
CLIENT_READ_TIMEOUT = 600
BPSTART_TIMEOUT = 600
BPEND_TIMEOUT = 600
Mediaserver
[root@mediaau ESD_NB_7.0_LinuxR_x86_64_FA]# yum install compat-libstdc++-296 xinetd libXp
[root@mediaau ESD_NB_7.0_LinuxR_x86_64_FA]# setenforce 0
setenforce: SELinux is disabled
[root@mediaau ESD_NB_7.0_LinuxR_x86_64_FA]# ./install
[root@mediaau ESD_NB_7.0_LinuxR_x86_64_FA]# sh /usr/openv/netbackup/logs/mklogdir
[root@mediaau ~]# cat /usr/openv/netbackup/bp.conf
SERVER = bksrvg
SERVER = mediaau
CLIENT_NAME = mediaau.gbgnetwork.net
USE_VXSS = PROHIBITED
VXSS_SERVICE_TYPE = INTEGRITYANDCONFIDENTIALITY
EMMSERVER = bksrvg
MEDIA_SERVER = mediaau.gbgnetwork.net
MEDIA_SERVER = mediag.gbgnetwork.net
MEDIA_SERVER = bksrvg.gbgnetwork.net
MEDIA_SERVER = gmed2.gbgnetwork.net
RE_READ_INTERVAL = 600
MPX_RESTORE_DELAY = 60
SERVER_CONNECT_TIMEOUT = 90
CLIENT_CONNECT_TIMEOUT = 600
CLIENT_READ_TIMEOUT = 600
BPSTART_TIMEOUT = 600
BPEND_TIMEOUT = 600
[root@mediaau ~]#
Tips:
tip1: How Add Netbackup media server to master server
masterserver :bksrvg
mediaserver 1:mediaau
mediaserver2 :gmed2
[root@bksrvg admincmd]# ./nbemmcmd -addhost -machinename mediaau -machinetype media -netbackupversion 7.0 -masterserver bksrvg -operatingsystem linux
NBEMMCMD, Version:7.0
Command completed successfully.
[root@bksrvg admincmd]# ./nbemmcmd -addhost -machinename gmed2 -machinetype media -netbackupversion 7.0 -masterserver bksrvg -operatingsystem windows
NBEMMCMD, Version:7.0
Command completed successfully.
[root@bksrvg admincmd]#
tip2: How Add License Keys
[root@bksrvg ~]# /usr/openv/netbackup/bin/admincmd/./bpminlicense -list_keys
?????-????-?????-????-????-???-?????-????-????-????-????-????-???-????-????-????-????-????-? 0x05000000 0x4c19c21c bksrvg
[root@bksrvg ~]#
[root@mediag ~]# /usr/openv/netbackup/bin/admincmd/./bpminlicense -list_keys
?????-????-?????-????-????-???-?????-????-????-????-????-????-???-????-????-????-????-????-? 0x05000000 0x4c19164d mediag.gbgnetwork.net
[root@mediag ~]#
[root@mediaau ~]# /usr/openv/netbackup/bin/admincmd/./bpminlicense -list_keys
?????-????-?????-????-????-???-?????-????-????-????-????-????-???-????-????-????-????-????-? 0x05000000 0x4c19cdb2 mediaau.gbgnetwork.net
[root@mediaau ~]#
tip2: How Delete License Keys
[root@mediaau ~]# /usr/openv/netbackup/bin/admincmd/./bpminlicense -delete_keys
[root@mediaau ~]# /usr/openv/netbackup/bin/admincmd/./bpminlicense -add_keys
tip3:How Increase Max job per client
[root@bksrvg bin]# /usr/openv/netbackup/bin/admincmd/./bpclient -add -client afilserver -max_jobs 100
[root@bksrvg bin]# /usr/openv/netbackup/bin/admincmd/./bpclient -add -client oldtdevelop-au -max_jobs 100
[root@bksrvg bin]# /usr/openv/netbackup/bin/admincmd/./bpclient -add -client mailbe -max_jobs 100
[root@bksrvg bin]#
[root@bksrvg admincmd]# ./bpclient -L -client gfilesrv
Client Name: gfilesrv
Current Host:
Hostname: gfilesrv
IP Address: 0.0.0.0
Dynamic Address: no
Free Browse: Allow
List Restore: Not Specified
Max Jobs This Client: Not Specified
WOFB Enabled: yes
WOFB FIM: VSS
WOFB Usage: Individual Drive Snapshot
WOFB Error Control: Abort on Error
Client Direct: Deduplication on the media server or
Move data via media server
Client Direct Restore: Move data via media server
OST Proxy: Off
OST Proxy Server: Unspecified
Connect options: 2 2 3
[root@bksrvg admincmd]#
tips4:socket read fail 23
[root@mediag ~]# cat /root/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/openv/netbackup/bin/
export PATH
unset USERNAME
[root@mediag ~]# bpclntcmd -pn
expecting response from server bksrvg
mediag.gbgnetwork.net *NULL* 172.20.21.27 54297
[root@mediag ~]#
[root@mediaau bin]# ./bpclntcmd -pn
expecting response from server bksrvg
mediaau.gbgnetwork.net *NULL* 172.21.0.28 32818
[root@mediaau bin]#
[root@mediag bin]# ./bpclntcmd -pn
expecting response from server bksrvg
mediag.gbgnetwork.net *NULL* 172.20.21.27 57504
[root@mediag bin]#
[root@bksrvg bin]# ./bpclntcmd -pn
expecting response from server bksrvg
bksrvg.gbgnetwork.net bksrvg 172.20.21.32 33606
[root@bksrvg bin]#
solution
backupservers
[root@bksrvg bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#servers
172.20.21.32 bksrvg.gbgnetwork.net bksrvg
172.20.21.27 mediag.gbgnetwork.net mediag
172.21.0.28 mediaau.gbgnetwork.net mediaau
#clients
172.20.21.28 gfilesrv.gbgnetwork.net gfilesrv
172.21.0.27 afileserver.gbgnetwork.net afileserver
172.20.21.9 mailbe.gbgnetwork.net mailbe
[root@bksrvg bin]#
one client
[root@bksrvg bin]# cat /mnt/smb/afileserver/c\$/hosts
127.0.0.1 localhost
172.20.21.32 bksrvg
172.20.21.27 mediag
172.21.0.28 mediaau
172.20.21.35 gmed2
172.20.21.32 bksrvg.gbgnetwork.net
172.20.21.27 mediag.gbgnetwork.net
172.21.0.28 mediaau.gbgnetwork.net
172.20.21.35 gmed2.gbgnetwork.net
tips5:
Disaster Recovery Procedure
Server
bksrvg
Date
Sat Jun 19 00:00:07 2010
Policy
hotcatalog-backup
Catalog Backup Status
the requested operation was successfully completed (status 0).
To ensure that the NetBackup catalog data is protected through Sat Jun 19 00:00:07 2010, retain a copy of the attached file, and the media or files listed below:
Catalog Recovery Media
Media Server Disk Image Path Image File Required
* mediag /home/storagemediag/bksrvg_1276889431_C1_TIR hotcatalog-backup_1276889431_INCR
* mediag /home/storagemediag/bksrvg_1276889431_C1_F1 hotcatalog-backup_1276889431_INCR
* mediag /home/storagemediag/bksrvg_1276889413_C1_F1 hotcatalog-backup_1276889413_INCR
* mediag /home/storagemediag/bksrvg_1276815927_C1_TIR hotcatalog-backup_1276815927_INCR
* mediag /home/storagemediag/bksrvg_1276815927_C1_F1 hotcatalog-backup_1276815927_INCR
* mediag /home/storagemediag/bksrvg_1276815890_C1_F1 hotcatalog-backup_1276815890_INCR
* mediag /home/storagemediag/bksrvg_1276772895_C1_TIR hotcatalog-backup_1276772895_FULL
* mediag /home/storagemediag/bksrvg_1276772895_C1_F1 hotcatalog-backup_1276772895_FULL
* mediag /home/storagemediag/bksrvg_1276772870_C1_F1 hotcatalog-backup_1276772870_FULL
DR file written to
/home/catalogDisasterRecovery/hotcatalog-backup_1276889431_INCR
* - Primary Media
Catalog Recovery Procedure for the Loss of an Entire Catalog
You should create a detailed disaster recovery plan to follow should it become necessary to restore your organization's data in the event of a disaster. A checklist of required tasks can be a tremendous tool in assisting associates in triage. For example, after the facility is safe for data to be restored, the power and data infrastructure need to be verified. When these tasks are completed, the following scenarios will help to quickly restore the NetBackup environment, and in turn, restore applications and data.
Disaster Recovery Procedure using the DR Image File
In the event of a catastrophic failure, use the following procedure to rebuild the previous NetBackup environment.
Note: If new hardware is required, make sure that the devices contain drives
capable of reading the media and that the drive controllers are capable of mounting the drives.
1. Install NetBackup.
2. Configure the devices necessary to read the media listed above.
3. Inventory the media.
4. Make sure that the master server can access the attached DR image file.
Start the NetBackup Recovery Wizard from the NetBackup Administration
Console. Or, start the wizard from a command line by entering
bprecover -wizard.
Disaster Recovery Procedure without the DR Image File
NOTE: ONLY ATTEMPT THIS AS A LAST RESORT If you do not have the attachment included with this email, use the following instructions to recover your catalog (If using OpenStorage disk pools, refer to the Shared Storage Guide to configure the disk pools instead of step 2 and 3 below ):
1. Install NetBackup.
2. Configure the devices necessary to read the media listed above.
3. Inventory the media.
4. Run:
bpimport -create_db_info [-server name] -id /home/storagemediag
5. Go to the following directory to find the DR image file
hotcatalog-backup_1276889431_INCR:
/usr/openv/netbackup/db/images/bksrvg/1276000000/tmp
6. Delete the other files in the directory.
7. Open hotcatalog-backup_1276889431_INCR file and find the BACKUP_ID
(for example: bksrvg_1276889431).
8. Run:
bpimport [-server name] -backupid bksrvg_1276889431
9. Run:
bprestore -T -w [-L progress_log] -C bksrvg -t 35 -p hotcatalog-backup -X -s 1276889431 -e 1276889431 /
10. Run the BAR user interface to restore the remaining image database
if the DR image is a result of an incremental backup.
11. To recover the NetBackup relational database, run:
bprecover -r -nbdb
12. Stop and Start NetBackup
13. Configure the devices if any device has changed since the last
backup.
14. To make sure the volume information is updated, inventory the media
to update the NetBackup database.
3.Configure VNC
[root@mediaau ~]# cat /etc/sysconfig/vncservers
# VNCSERVERS="2:myusername"</p> <p style="margin-bottom: 0in; text-align: left;"># VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"</p> <p style="margin-bottom: 0in; text-align: left;">VNCSERVERS="1:mbahmani 2:mbahmani 3:mbahmani"</p> <p style="margin-bottom: 0in; text-align: left;">VNCSERVERARGS[1]="-geometry 1024x768"</p> <p style="margin-bottom: 0in; text-align: left;">VNCSERVERARGS[2]="-geometry 1024x768"</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;">[root@mediaau ~]#</p> <p style="margin-bottom: 0in; text-align: left;">[root@mediaau ~]# su - mbahmani</p> <p style="margin-bottom: 0in; text-align: left;">
[mbahmani@mediaau ~]$ vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /home/mbahmani/.Xauthority
New 'mediaau.gbgnetwork.net:1 (mbahmani)' desktop is mediaau.gbgnetwork.net:1
Creating default startup script /home/mbahmani/.vnc/xstartup
Starting applications specified in /home/mbahmani/.vnc/xstartup
Log file is /home/mbahmani/.vnc/mediaau.gbgnetwork.net:1.log
[mbahmani@mediaau ~]$
[mbahmani@mediaau ~]$ cat .vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
exec gnome-session &
[mbahmani@mediaau ~]$
[root@mediaau ~]# service vncserver restart
4.Linux Tune Network Stack (Buffers Size) To Increase Networking Performance
By default the Linux network stack is not configured for high speed large file transfer across WAN links. This is done to save memory resources. You can easily tune Linux network stack by increasing network buffers size for high-speed networks that connect server systems to handle more network packets.
The default maximum Linux TCP buffer sizes are way too small. TCP memory is calculated automatically based on system memory; you can find the actual values by typing the following commands:
$ cat /proc/sys/net/ipv4/tcp_mem
The default and maximum amount for the receive socket memory:
$ cat /proc/sys/net/core/rmem_default
$ cat /proc/sys/net/core/rmem_max
The default and maximum amount for the send socket memory:
$ cat /proc/sys/net/core/wmem_default
$ cat /proc/sys/net/core/wmem_max
The maximum amount of option memory buffers:
$ cat /proc/sys/net/core/optmem_max
Tune values
Set the max OS send buffer size (wmem) and receive buffer size (rmem) to 12 MB for queues on all protocols. In other words set the amount of memory that is allocated for each TCP socket when it is opened or created while transferring files
# echo 'net.core.wmem_max=12582912' >> /etc/sysctl.conf
# echo 'net.core.rmem_max=12582912' >> /etc/sysctl.conf
You also need to set minimum size, initial size, and maximum size in bytes:
# echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf
# echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf
Turn on window scaling which can be an option to enlarge the transfer window:
# echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
Enable timestamps as defined in RFC1323:
# echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
Enable select acknowledgments:
# echo 'net.ipv4.tcp_sack = 1' >> /etc/sysctl.conf
By default, TCP saves various connection metrics in the route cache when the connection closes, so that connections established in the near future can use these to set initial conditions. Usually, this increases overall performance, but may sometimes cause performance degradation. If set, TCP will not cache metrics on closing connections.
# echo 'net.ipv4.tcp_no_metrics_save = 1' >> /etc/sysctl.conf
Set maximum number of packets, queued on the INPUT side, when the interface receives packets faster than kernel can process them.
# echo 'net.core.netdev_max_backlog = 5000' >> /etc/sysctl.conf
Now reload the changes:
# sysctl -p
Use tcpdump to view changes for eth0:
# tcpdump -ni eth0
RUN following Commands
echo 'net.core.wmem_max=12582912' >> /etc/sysctl.conf
echo 'net.core.rmem_max=12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_sack = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_no_metrics_save = 1' >> /etc/sysctl.conf
echo 'net.core.netdev_max_backlog = 5000' >> /etc/sysctl.conf
sysctl -p
4.how to increase ext3 filesystems performance ?
Ext3 & ReiserFS has three kinds of journaling methods
1)JournalDataWriteback
2)JournalDataOrdered
3)Journal Data
By default the the 2nd method is used.To speed things up we will make it use method 1. The price to pay is that it may allow old data to appear in files after a crash and journal recovery.
How to make ext3 or reiserfs use journal data writeback
First you need to take fstab file using the following command
sudo cp /etc/fstab /etc/fstab.orig
Edit the /etc/fstab file using the following command
sudo vi /etc/fstab
Add the thing marked in bold to your fstab root mount line.
/dev/hda1 / ext3 defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
Save that file and exit
You need to take Grubmenu file backup using the following command
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.orig
Now you need to edit the grub menu list file using the following command
sudo vi /boot/grub/menu.lst
look for the following two lines
#defoptions=quietsplash
# altoptions=(recovery mode) single
change to
#defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
Save that file and exit
Now you need to update the grub using the following command
sudo update-grub
the added flags will automatically be added to the kernel line and stay there in case of kernel update
Changes to Ext3 FileSystem Only
Note:- tune2fs only works for ext3. Reiserfs can’t change the journal method
Before rebooting change the filesystem manually to writeback using the following command
sudo tune2fs -o journal_data_writeback /dev/hda1
Check that it is running or not using the following command
sudo tune2fs -l /dev/hda1
Remove update of access time for files
Having the modified time change you can understand but having the system updating the access time every time a file is accessed is not to my liking. According to the manual the only thing that might happen if you turn this off is that when compiling certain things the make might need that info.
To change this do the following
sudo vi /etc/fstab
add the following marked in bold
/dev/hda1 / ext3 defaults,errors=remount-ro,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
Now reboot and enjoy a much faster system
[root@mediaau ~]# tune2fs -o journal_data_writeback /dev/VGVMlocal1/lvdata
tune2fs 1.39 (29-May-2006)
[root@mediaau ~]# vim /etc/fstab
[root@mediaau ~]# cat /etc/fstab
/dev/VGVMlocal/lvroot / ext3 defaults 1 1
/dev/VGVMlocal/lvvar /var ext3 defaults 1 2
/dev/VGVMlocal/lvhome /home ext3 defaults 1 2
/dev/VGVMlocal/lvusr /usr ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VGVMlocal/lvswap swap swap defaults 0 0
/dev/VGVMlocal1/lvdata /home/storagemediag ext3 defaults,errors=remount-ro,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 1 2
[root@mediaau ~]#
[root@bksrvg nazanin font]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,0)
# kernel /vmlinuz-version ro root=/dev/VGOS/lvroot
# initrd /initrd-version.img
#boot=/dev/cciss/c0d0
default=0
timeout=5
# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
splashimage=(hd1,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5)
root (hd1,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VGOS/lvroot rhgb quiet rootflags=data=writeback
initrd /initrd-2.6.18-194.el5.img
title Other
rootnoverify (hd0,0)
chainloader +1
[root@bksrvg nazanin font]#
[root@mediag ~]# cat /etc/fstab
/dev/VGOS/lvroot / ext3 defaults 1 1
/dev/VGOS/lvvar /var ext3 defaults 1 2
/dev/VGOS/lvusr /usr ext3 defaults 1 2
/dev/VGOS/lvhome /home ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VGOS/lvswap swap swap defaults 0 0
/dev/VGVMlocal/lvdata /home/storagemediag ext3 defaults,errors=remount-ro,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 1 2
[root@mediag ~]#
5.Installing fonts
[root@bksrvg ~]# /usr/sbin/chkfontpath --list
Current directories in font path:
1: /usr/share/X11/fonts/misc:unscaled
2: /usr/share/X11/fonts/75dpi:unscaled
3: /usr/share/X11/fonts/100dpi:unscaled
4: /usr/share/X11/fonts/Type1
5: /usr/share/X11/fonts/TTF
6: /usr/share/fonts/default/Type1
[root@bksrvg ~]# \cp -rvf /mnt/smb/gfilesrv/golestan\$/Units/IT/Common/Customized/Network/Software\ and\ Images/nazanin\ font/*.TTF /usr/share/X11/fonts/TTF/
[root@bksrvg ~]# fc-cache
6.autofs , …
[root@mediaau ~]# yum install fuse-ntfs-3g.x86_64 firefox.x86_64
[root@bksrvg ESD_NB_7.0_LinuxR_x86_64_FA]# for i in `ls /etc/auto*`; do echo;echo "=====================================";echo $i;echo "====================================="; cat $i |grep -v '^#' |grep -v '$^'; done</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;"></p> <p style="margin-bottom: 0in; text-align: left;">=====================================
/etc/auto.master
=====================================
+auto.master
/mnt/smb /etc/auto.smb.top --timeout=60
=====================================
/etc/auto.misc
=====================================
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
=====================================
/etc/auto.net
=====================================
key="$1"</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;">opts="-fstype=nfs,hard,intr,nodev,nosuid"</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;">for P in /bin /sbin /usr/bin /usr/sbin</p> <p style="margin-bottom: 0in; text-align: left;">do
for M in showmount kshowmount
do
if [ -x $P/$M ]
then
SMNT=$P/$M
break
fi
done
done
[ -x $SMNT ] || exit 1
SHOWMOUNT="$SMNT --no-headers -e $key"</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;">$SHOWMOUNT | LC_ALL=C sort -k 1 | \</p> <p style="margin-bottom: 0in; text-align: left;">awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }</p> <p style="margin-bottom: 0in; text-align: left;">{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
END { if (!first) print "\n"; else exit 1 }
' | sed 's/#/\\#/g'
=====================================
/etc/auto.smb
=====================================
key="$1"</p> <p style="margin-bottom: 0in; text-align: left;">opts="-fstype=cifs"</p> <p style="margin-bottom: 0in; text-align: left;"> </p> <p style="margin-bottom: 0in; text-align: left;">for P in /bin /sbin /usr/bin /usr/sbin</p> <p style="margin-bottom: 0in; text-align: left;">do</p> <p style="margin-bottom: 0in; text-align: left;">if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done
[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '
BEGIN { ORS=""; first=1 }</p> <p style="margin-bottom: 0in; text-align: left;">/Disk/ {</p> <p style="margin-bottom: 0in; text-align: left;">if (first)</p> <p style="margin-bottom: 0in; text-align: left;">print opts; first=0</p> <p style="margin-bottom: 0in; text-align: left;">dir = $2
loc = $2
# Enclose mount dir and location in quotes
# Double quote "$" in location as it is special
gsub(/\$$/, "\\$", loc);
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
}
END { if (!first) print "\n"; else exit 1 }
'
=====================================
/etc/auto.smb.gfilesrv
=====================================
username=backupadmin
password=?????????
=====================================
/etc/auto.smb.sub
=====================================
* -fstype=cifs,file_mode=0777,dir_mode=0777,credentials=/etc/auto.smb.gfilesrv ://${host}/&
=====================================
/etc/auto.smb.sub1
=====================================
* -fstype=cifs,file_mode=0777,dir_mode=0777,credentials=/etc/auto.smb.gfilesrv ://gmed2/bkmnt
=====================================
/etc/auto.smb.top
=====================================
* -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub
[root@bksrvg ESD_NB_7.0_LinuxR_x86_64_FA]#

