[mythtv-users] OT: out of disk space, but not really....
John Van Ostrand
john at netdirect.ca
Wed Dec 29 14:31:51 UTC 2004
> Thanks to those who gave me some help on this. No real surprise, turns
> out it really was out of space. I have a script that runs at night that
> mounts an nfs drive on another machine and backs up my recordings. The
> mount must have failed a couple nights ago, so everything was copied
> locally instead of to the other machine. I "assumed" it was still
> mounted so I ignored the /mnt/storage directory thinking it was on
> another machine.
>
> I need to figure out how to tell my script to only rsync the files if
> the mount worked correctly. Anyone know how to do that? My script is
> simply:
>
> mount 192.168.1.22:/storage /mnt/storage
> rsync -av --delete --exclude=nice_names /mythtv/recordings
> /mnt/storage/mythtv
> rsync -av --delete /mythtv/music /mnt/storage/mythtv
> rsync -av --delete /mythvideos /mnt/storage/mythtv
> umount /mnt/storage
>
> I know with scp I could do it without mounting the drives, but I'd
> rather use rsync. Anyway to do this without mounting the drives this
> way?
To see if a drive is mounted use something like this:
if mount | grep "/mnt/storage" >> /dev/null
then
echo "Drive is mounted"
else
echo "Drive is not mounted"
fi
You could also consider using the SSH option to rsync:
Setup a SSH identity on the system where you'll be running the rsync:
ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root at myth
Then copy the /root/.ssh/id_rsa.pub to the remote
systems /root/.ssh/authorized_keys2
cat /root/.ssh/id_rsa.pub | ssh root at REMOTESYSTEM "cat
> /root/.ssh/authorized_keys2"
Now you should be able to ssh from the one server to the other, as those
users without a password.
Then script:
rsync -av --delete --exclude=nice_names /mythtv/recordings
REMOTESYTEM:/storage/mythtv
More information about the mythtv-users
mailing list