copying to USB hard drive with a bash script

If none of the more specific forums is the right place to ask

copying to USB hard drive with a bash script

Postby Adeel » 2006-03-01 11:04

Hello All

I have a problem. I am using a simple bash script to copy some files as a backup on USB hard drive from my file server. When trying to run the script I am getting error of the following type

---- output starts

cp: cannot create regular file `/mnt/BackupDisk/MarinusBackup/data/RedHat9Etc/lynx.cfg.ja': Read-only file system
cp: cannot create regular file `/mnt/BackupDisk/MarinusBackup/data/RedHat9Etc/lynx.cfg.sk': Read-only file system
cp: cannot create regular file `/mnt/BackupDisk/MarinusBackup/data/RedHat9Etc/pine.conf': Read-only file system
cp: cannot create regular file `/mnt/BackupDisk/MarinusBackup/data/RedHat9Etc/pine.conf.fixed': Read-only file system
cp: preserving times for `/mnt/BackupDisk/MarinusBackup/data/RedHat9Etc': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/samba_share': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/stardata': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/data_parsening': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/.Trash-root': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/hda4_samba_share': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/data/dataTransfer': Read-only file system
cp: preserving times for `/mnt/BackupDisk/MarinusBackup/data': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/samba_share': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/home': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/etc': Read-only file system
cp: cannot create directory `/mnt/BackupDisk/MarinusBackup/boot': Read-only file system

-------------- output finished

The files I am trying to copy has previliges of 775. I have set the previliges for the script as "777" and the when I use the mount command the external hard drive is displayed as

/dev/sdb2 on /mnt/BackupDisk type ext3 (rw,nodev)


I am logged in as root while doing this. The script is simple using the command after mount the hard drive

cp -pr oldDirectory newDirectory


As you probably know by this time I am fairly new to Linux, so if possible go easy...

Would appreciate any help in solving this

Regards

Adeel.
Adeel
 
Posts: 5
Joined: 2006-03-01 10:38

Postby RWIndiana » 2006-03-03 01:19

what does your /etc/fstab file look like? I really don't know cause I'm a newbie myself, but I would try editing your fstab entry for sdb2 to read "rw,user,noauto". Or maybe include "defaults"

Sorry that's all I can think of right now. If you don't need the -p option, you could try it just using cp -r.
RWIndiana
 
Posts: 136
Joined: 2005-09-30 17:44

Postby Adeel » 2006-03-03 15:01

Thankyou RWIndiana

I have looked at fstab and its has the neccessary options like noauto,rw, user etc. I appreciate your effort though.

I have been looking around a bit. From the emails that are generated by root as system status I have found some thing intruiging. Here is a relevant portion.

-----Kernel starts------

WARNING: Kernel Errors Present
EXT3-fs error (device sd(8,18)...: 2451Time(s)
EXT3-fs warning (device sd(8,18)): ext3_clear_journal_err: Filesystem error recorded from pr...: 5Time(s)
EXT3-fs warning: mounting fs with errors, running e2fsck...: 11Time(s)
Error (-5) on journal ...: 6Time(s)
journal commit I/O error...: 6Time(s)

---kernel ends-----------


Could it be possible that media is some how corrupted??. I also know that files which are located on samba share are giving trouble. The ones which are on linux server and not visible in samba share can be copied easily.....


Any suggestions ???

Thanx

Adeel.
Adeel
 
Posts: 5
Joined: 2006-03-01 10:38

Postby Arawn » 2006-03-03 15:34

Will you make a checkdisk ?
User avatar
Arawn
 
Posts: 21
Joined: 2006-02-27 13:02
Location: Lyon, France

Postby Adeel » 2006-03-06 08:19

Hello Arawn

Thanx for your response. I ran "fsck" thing on the relevant drive and am getting a long output of this kind. Does that mean I have bad sectors on the drive??

---output starts--------

Illegal block #2060 (4294967295) in inode 8. IGNORED.

Illegal block #2061 (4294967295) in inode 8. IGNORED.

Illegal block #2062 (4294967295) in inode 8. IGNORED.

Illegal block #2063 (4294967295) in inode 8. IGNORED.

Illegal block #2064 (4294967295) in inode 8. IGNORED.

Illegal block #2065 (4294967295) in inode 8. IGNORED.

Illegal block #2066 (4294967295) in inode 8. IGNORED.

Illegal block #2067 (4294967295) in inode 8. IGNORED.

Illegal block #2068 (4294967295) in inode 8. IGNORED.

Illegal block #2069 (4294967295) in inode 8. IGNORED.

Illegal block #2070 (4294967295) in inode 8. IGNORED.

Too many illegal blocks in inode 8.

Clear inode<y>?


------output ends--------


Do I have to format the whole drive now to make it work? If yes whats the best way to do so?

Regards

Adeel.
Adeel
 
Posts: 5
Joined: 2006-03-01 10:38

Postby Arawn » 2006-03-06 10:05

I don't know sorry. I will format the drive.
User avatar
Arawn
 
Posts: 21
Joined: 2006-02-27 13:02
Location: Lyon, France

Postby Adeel » 2006-03-09 11:17

Well guys it was simple. Just formatted the drive and now every thing is working fine. Thanx for all the input, I appreciate it.
Adeel
 
Posts: 5
Joined: 2006-03-01 10:38


Return to General Questions

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable