Backup Disk


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Backup Disk
# 1  
Old 11-01-2013
Backup Disk

I have a backup script. Before it runs it need to check the backup disk is connected. It usually mounts to /Volumes/Files_Bakup_1

I wrote a bit of script to do the check but it has failed me.

Code:
if
! cd /Volumes/Files_Backup_1
then
    echo "could not connect to external hard drive";
    echo "Dear Admin, The backup script Server_Backup.sh could not connect to external hard disk.\
    Please check and reconnect it!" | mail -s "MAILSERVER BACKUP" admin@domain.com  
    exit 0;
else
    echo "making copy directory"
    copy_dir="/Volumes/Files_Backup_1/Backup_"`date +%Y-%m-%d_%H%M%S`
    mkdir $copy_dir
fi

All it does is check if it can change directory to the Volume it mounted on if it can't then it emails me.

This failed because the code
Code:
cd /Volumes/Files_Backup_1

would just hang forever and the sh script would never get passed that line.
Is there a better way to test the backup disk is connected?

P.S i went in to terminal and issued

Code:
cd /Volumes
ls

Which gave me results
Code:
Files        Files_Backup_1    Server HD2

but when i issued
Code:
df

I got

Code:
Filesystem              512-blocks       Used     Avail Capacity  Mounted on
/dev/disk0s3             160574256   73153056  86909200    46%    /
devfs                          206        206         0   100%    /dev
fdesc                            2          2         0   100%    /dev
<volfs>                       1024       1024         0   100%    /.vol
/dev/disk2s10            976509184   67922320 908586864     7%    /Volumes/Files
automount -nsl [215]             0          0         0   100%    /Network
automount -fstab [234]           0          0         0   100%    /automount/Servers
automount -static [234]          0          0         0   100%    /automount/static

No sign of the backup disk.
If i then did
Code:
cd Files_Backup_1

the computer would hang. in my sftp client i couldn't even cd to /Volumes it just would hang.

What is wrong with my backup disk why does it do this?

Last edited by vbe; 11-01-2013 at 02:46 PM..
# 2  
Old 11-01-2013
This sort of issue is frequently encountered when you have network issues, and/or the nfs-server is not responding... Can be a nightmare if you have filesystems already mounted and e.g. had an ls of a NFS directory...
Should we understand your script worked so far but now you met a sever issue, you want to try to correct things or is it your first atempt and its not working?
This User Gave Thanks to vbe For This Post:
# 3  
Old 11-04-2013
Hi again sorry for the late reply.

Yes the backup script had been working fine for a long time then one day i checked my backups and noticed backups were missing and this first time the hard disk had unmounted itself. Then i updated the script to email me if it cant cd the volume. Then about two weeks later i had the script hanging on the cd command. How will i go about diagnosing this problem?
# 4  
Old 11-04-2013
If i understand correctly /Volumes/Files_Backup_1 is your mount point. The mount point will always be there, because it is part of the parent FS. To make sure you have something mounted there you either have to check for /Volumes/Files_Backup_1/somefile or use the mount and search for your mount. Something like

Code:
if mount | grep -q "/Volumes/Files_Backup_1" ; then ...

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 5  
Old 11-04-2013
Thanks bakunin.

I think this will be very helpful. I can use this in my backup scripts to determine if the disk is mounted however I am unsure what i will need to do to find out why this is happening. If it is a network issue as vbe suggests I assume i need to catch the moment that this fails and notify me so i can check the system logs at this point. Is this something i can achieve with cron?
# 6  
Old 11-04-2013
I usually test before anything else the presence and operationnal NFS...
You could try to use touch on the FS and check the return code and if OK, conitnue...
I find it useless to test permanetly to see if its there when not needed...
And If not OK your script should warn you...
If you are using automounter then do cd 2NFS; sleep 1 so it has time to mount... (ajust the sleep accordingly maybe 1 is too short...)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Whole disk backup in Solaris 11

Hello! I have an Oracle server X5-2 with Solaris 11. Now, this server will get repurposed before I get a system of my own. I am a beginner...but is there a way I can make a backup or an image of my whole disk so when I get my own system I can just restore without having to reinstall software... (1 Reply)
Discussion started by: chipsandiscream
1 Replies

2. Solaris

Need help in creating script for disk mirror and backup

Hi, I am very new to scripting. I need to create a script which does following. Scenario: First get the format command output echo | format Insert the new disk to Solaris Server Get Zpool status format the new disk ( Here I need to select the new disk which have been inserted, I do... (1 Reply)
Discussion started by: praveensharma21
1 Replies

3. Solaris

Solaris patching using mirror disk backup? need help!

hi friends, need help.. it is my first time patching using mirror disk backup approach, not so sure about the steps :confused: how do you detach, patch it, boot it and reattach it ? any kind soul here can advise ? thanks in advance..:) below is the information from my machine: Filesystem ... (3 Replies)
Discussion started by: Exposure
3 Replies

4. Solaris

backup the whole system to a usb disk.

Hi dears, im working with a sun sparc server(M4000) , solaris 10 installed. I need a little help, because i wanna know if is it possible to backup the whole system in a usb disk. Im gonna explain you a little more why i want to do it. Currently i have installed a Solaris 10 working with... (5 Replies)
Discussion started by: botella
5 Replies

5. UNIX for Dummies Questions & Answers

Does formatting slice 2 (backup) destroy disk geometry?

I am a new Unix Sys Admin who is learning mostly from books with minimal classroom training (ie: no certificates, training is largely hands-on, conducted at work). I work with Solaris 8 through 10, and with some fairly outdated hardware. In my work restoring old workstations I have been instructed... (2 Replies)
Discussion started by: mia-chan
2 Replies

6. Solaris

Broken system disk - mount a zfs backup fs

I have installed Solaris 11 Express on my machine. I have made a script which would take snapshots of all the rpool filesystems every day and send them to a (local) hard drive. There is a zpool on that drive called backup. Now in case of a system failure, I will act according to a manual on the... (1 Reply)
Discussion started by: RychnD
1 Replies

7. UNIX for Dummies Questions & Answers

Backup Hard Disk Xenix System V

Hey all, At my work we have an installation that runs on a Xenix System V coupled with a PLC. Now I have to take a backup of the complete Hard Disk from the PC but have no idea how to manage this. Could someone help me and tell me which steps I have to take. Thanx. (8 Replies)
Discussion started by: sideshow bob
8 Replies

8. Solaris

Unable to take backup of /var on another disk !!

Hi Gurus, I have to back the /var to other disk, however I am unable to do so. What I did is Created a partition on another disk, placed file system on the slice and mounted on /mnt . Issued following command #ufsdump 0cfu /mnt /var And I am getting... (2 Replies)
Discussion started by: kumarmani
2 Replies

9. UNIX for Dummies Questions & Answers

backup disk to disk to tape question

Hi all I had started to learn how to backup disk to disk to tape method Firstly I had backup to my NAS tar czvf /MyNetworkStorge/backup.tar /home Secondly I using dd command to copy the tar to tape dd if=/MyNetworkStorge/backup.tar of=/dev/tape0 But the tape drive always hang.... (5 Replies)
Discussion started by: lijiajin
5 Replies

10. UNIX for Dummies Questions & Answers

Staging a backup DISK

Hi, Experts ! I've met a following challenge: I have a unix machine, and I need to take a backup of its disk in order to use it for staging of the next machine in the future. But I try to find some information on how it is best to do it. The spare disk which I have is new and not formatted,... (4 Replies)
Discussion started by: DGoubine
4 Replies
Login or Register to Ask a Question