I work and have to save an important file in four other locations besides a Linux HD. Instead of having to save the same file for four more times, I would like to automate the procedure through a linux script file in which the first saved file on the Linux HD can be copied simultaneously to a Windows Vista HD, an external HD and to two flash drives.

My PC has two HDs. Windows Vista is installed on one, and openSuse 11.1 is installed on the other one. Windows Vista appears on SATA 1 {/dev/sda1} while openSuse 11.1 appears on SATA 2 {/dev/sdb1}. When I wish to switch from one OS to the other I just enter directly into the BIOS setup utility to change the HD boot order leaving the Windows and the Linux installs untouched.

For the second part of a shell script repeating-line similar to

# rsync -av /home/user/project/a.file /user storage device/project

where the required storage devices are

/dev/sde1 ... that is... an external hard disk {Maxtor 3200}
/dev/sdc1 ... ..."....."... a USB flash drive ....... {usb 1}
/dev/sdd1 ... ..."....."... a USB flash drive ....... {usb 2} and
/dev/sda1 ... ..."....."... a Windows Vista hard disk

to which I want to backup simultaneously there the content of the first part on the above line in openSuse 11.1 instead of having to save the same "a.file" for four more times, I receive a series of error messages when I try to run the following "rsync" commands:

# rsync -av /home/user/project/a.file /media/Maxtor 3200/project

rsync: link_stat "/media/Maxtor" failed: No such file or directory (2)
rsync: change_dir#3 "/home/user/3200/project" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(614) [receiver=3.0.4]
rsync: connection unexpectedly closed (99 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]

# rsync -av /home/user/project/a.file /media/usb 1/project

rsync: link_stat "/media/usb" failed: No such file or directory (2)
rsync: change_dir#3 "/home/user/1" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(614) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]

# rsync -av /home/user/project/a.file /media/usb 2/project

rsync: link_stat "/media/usb" failed: No such file or directory (2)
rsync: change_dir#3 "/home/user/2" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(614) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]

# rsync -av /home/user/project/a.file /media/disk/user/project

rsync: link_stat "/media/disk/user/" failed: No such file or directory (2)
rsync: link_stat "/home/user/" failed: No such file or directory (2)
rsync: change_dir#3 "/home/user/project" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(614) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]

In the graphical user interface (GUI) I can access and open the filesystems on all of the above storage devices. In the command line interface (CLI) however I do not know how to do it.

The backup script that I have in mind is aimed at updating simultaneously four file copies that are all on a local machine after the main "a.file" has been saved. I am not considering any actions or operations from Windows to Linux, but rather performing the whole updating process in openSuse 11.1 to keep things easier.

I will appreciate your assistance on any missing rsync options or other programming aspects that might have been overlooked.

Recommended Answers

All 3 Replies

What is the output from running the following 2 commands: df, mount

What is the output from running the following 2 commands: df, mount

Thank you very much for answering.

The output for df is

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sdb2 20641788 3865840 15727308 20% /

udev 2025832 224 2025608 1% /dev

/dev/sdb3 265735884 403384 251833884 1% /home

/dev/sdc1 3991136 12224 3978912 1% /media/usb 1

/dev/sda1 488384508 95190424 393194084 20% /media/disk

/dev/sde1 97683452 10308644 87374808 11% /media/Maxtor 3200

/dev/sdd1 3991136 2932384 1058752 74% /media/usb 2


The output for mount is

/dev/sdb2 on / type ext3 (rw,acl,user_xattr)

/proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

debugfs on /sys/kernel/debug type debugfs (rw)

udev on /dev type tmpfs (rw)

devpts on /dev/pts type devpts (rw,mode=0620,gid=5)

/dev/sdb3 on /home type ext3 (rw,acl,user_xattr)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

securityfs on /sys/kernel/security type securityfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

gvfs-fuse-daemon on /home/stephen/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=stephen)

/dev/sdc1 on /media/usb 1 type vfat (rw,nosuid,nodev,shortname=lower,flush,utf8,uid=1000)

/dev/sda1 on /media/disk type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

/dev/sde1 on /media/Maxtor 3200 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

/dev/sdd1 on /media/usb 2 type vfat (rw,nosuid,nodev,shortname=lower,flush,utf8,uid=1000)

When I run the executable script

# Script "backup.file.sh"
#!/bin/sh # starts
#
# A shell script to backup an updated "a.file" from the
# /home/user/project directory on the hard disk to the
# /project directory on a flash drive as an exact "a.file"
# copy.
# The updated "a.file" will then be backed up to
#
# another /project directory on a second flash drive,
# to a /project directory on an external hard disk, and last
# to a /project directory on a Windows Vista NTFS hard disk.
#
# rsync [options] from local SOURCE ...to... local DESTINATION
#
# [options are] progress, archive, verbose, preserve Hard links
#
rsync -P -a -v -H /home/stephen/project/a.file /dev/sdc1 /media/usb 1/project # the first backup operation for the "a.file"
#
# reminder chmod 755 backup.file.sh [convert to executable]
# reminder [run] ./backup.file.sh
#

I receive the following error message:

sending incremental file list
rsync: link_stat "/media/usb" failed: No such file or directory (2)
rsync: mkdir "/home/stephen/1/project" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.4]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(632) [sender=3.0.4]

I ran the df command and the filesystem "/dev/sdc1" is mounted on "/media/usb 1". When I ran the mount command it writes onscreen

/dev/sdc1 on /media/usb 1 type vfat (rw,nosuid,nodev,shortname=lower,flush,utf8,uid=1000)

The flash drive "usb 1" also has a /project directory. However, an error occurs that I have tried hard to solve.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.