Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

copying to USB hard drive with a bash script

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Adeel
Posts: 5
Joined: 2006-03-01 10:38

copying to USB hard drive with a bash script

#1 Post by Adeel »

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.

RWIndiana
Posts: 136
Joined: 2005-09-30 17:44

#2 Post by RWIndiana »

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.

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

#3 Post by Adeel »

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.

User avatar
Arawn
Posts: 20
Joined: 2006-02-27 13:02
Location: Lyon, France

#4 Post by Arawn »

Will you make a checkdisk ?

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

#5 Post by Adeel »

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.

User avatar
Arawn
Posts: 20
Joined: 2006-02-27 13:02
Location: Lyon, France

#6 Post by Arawn »

I don't know sorry. I will format the drive.

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

#7 Post by Adeel »

Well guys it was simple. Just formatted the drive and now every thing is working fine. Thanx for all the input, I appreciate it.

Post Reply