LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-26-2008, 03:25 PM   #1
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191
Blog Entries: 1

Rep: Reputation: 15
Can't rsync to USB drive


Frustrated and embarrassed, I can't seem to get this command to work. I know I have permissions right. It must be that I'm not typing something right.

sudo rsync -avz --delete /source/directory /destination/directory

where: /home/rich is source, but I'm not clear what the destination is.

I have tried these:
/media/my_external/Backup
/dev/sdb1/my_external/Backup
/my_external/Backup

"my_external" is the label I assigned the USB drive. I created a folder on that drive named Backup.

Any ideas what I'm doing wrong.
 
Old 07-26-2008, 03:44 PM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
/media/my_external/Backup should be the right one if it is mounted to /media

What filesystem is on that drive? (I ask because probably all of them come formated as "vfat" - which will not work)
If it is a linux filesystem: how is it mounted?
What was the error?
 
Old 07-26-2008, 03:45 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well you need to mount the drive somewhere before you can use it with rsync. so forget about rsync for now and just check where it's mounted with the mount command itself.
 
Old 07-26-2008, 05:37 PM   #4
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
I formatted it to ext3.

I'm lost about mounting it. Don't understand at all. I plug in the USB cable, the icon is on the desktop. I can drag and drop or copy paste files. But not rsync. How do I mount it, and where? Confused.

Results of mount:
rich@rich-laptop:~$ mount my_external
[mntent]: warning: no final newline at the end of /etc/fstab
mount: can't find /home/rich/my_external in /etc/fstab or /etc/mtab
 
Old 07-26-2008, 05:52 PM   #5
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
OK. It seems to be mounted. Here's the result of mount. I see it in the last line.

rich@rich-laptop:~$ mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.20-17-generic/volatile type tmpfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/scd0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev,user=rich)
/dev/sdb1 on /media/my_external_ type ext3 (rw,nosuid,nodev)
rich@rich-laptop:~$
 
Old 07-26-2008, 06:00 PM   #6
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
rich@rich-laptop:~$ sudo rsync -avz --delete /home/rich/Test.odt /media/my_external
Password:
building file list ... done
Test.odt

sent 23990 bytes received 42 bytes 48064.00 bytes/sec
total size is 25412 speedup is 1.06
rich@rich-laptop:~$

Does this look like it wrote the file on the USB? It is NOT on the USB. Hmmmm. It surely must be something simple I'm doing wrong, but ???
 
Old 07-27-2008, 01:25 AM   #7
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
The mount options seem to be the problem. It is mounted automatically for you with options: "nosuid" and "nodev"
"nosuid" likely beeing the problem.

Mount it "by hand".
Code:
# first unmount it from /media
sudo umount /media/my_external_
# then make the mountpoint
sudo mkdir /mnt/my_mountpoint
# mount it
sudo mount /dev/sdb1 /mnt/my_mountpoint/
# and then try:
sudo rsync -avz --delete /home/rich/Test.odt /mnt/my_mountpoint/
Be sure what you write: you wrote:
my_external_
but also
my_external
obviously only one is correct
 
Old 07-27-2008, 01:57 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well you mount output clearly states "/media/my_external_" not "/media/my_external"
 
Old 07-27-2008, 01:10 PM   #9
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
I made several mistakes. One is that I did a right-click > Create Folder within the USB drive browser window. And I did some copy-paste and drag-drop to the USB. Then messing around more, I seem to have mounted it twice, which caused the duplicate folders:

my_external
my_external_

Looks like I need to add everything to the USB via tar, rsync, or such - to maintain permissions, etc. NO copy-paste, and NO right-click > Create Folder from the USB browser window.

I used nautilus to delete everything. Then WAS able to write files on the drive with tar, and also with rsync.

But deleting everything like that also removed the lost+found folder. So, I did a fresh reformat to ext3 for a clean start.

I'd like to do more testing, by adding archives, folders, files to the USB drive, can I "correctly" delete them by right-click > Move to Trash from within the USB drive browser window? Or do I need to use tar or rsync to remove them?

Thank you for helping!
 
Old 07-27-2008, 02:32 PM   #10
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
If you just wanted to copy something to the drive - drag&drop would be a good way.
To use rsync you need the permissions to be different than they are when it is automatically mounted (when you plug it in).

The lost+found folder is not important at all - it will be recreated everytime you fsck (check) the drive.

to remove:
Nautilus preferences --> behaviour --> trash: provide a delete command circumventing the trash
I think it will just alert you that it cannot move to trash and offer deleting instead.
 
Old 07-27-2008, 03:32 PM   #11
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Thank you!
 
Old 08-11-2008, 04:22 PM   #12
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
I need help again !! My machine crashed this morning (another topic for later) and I need to restore things.
On the USB drive, in a folder named 07_31_2008 I placed the following:
rich (home dir)
etc
var
usr

I need to get those on to my laptop hard drive. I have tried different combinations of the rsync command to copy from the USB to sda1, but none of them work. I don't know how to issue the rsync command to restore those files back to my laptop FROM the USB drive.

Can you help me?

Thank you.
 
Old 08-11-2008, 07:03 PM   #13
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Dang. The "options" in the rsync command are NOT OPTIONAL.
You MUST include at least on OPTION.

This continues to trick my pea brain. Arrgghhh!!!!

Got it fixed. Back to work.

Rich
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Debian on USB Hard Drive/USB Jump Drive kushalkoolwal Debian 10 02-26-2009 01:46 PM
Rsync errors to USB drive jstars Linux - Server 8 12-23-2006 11:35 PM
rsync usb drive win95 fat32 PDock Linux - Software 1 06-12-2006 05:24 AM
rsync fails with USB hard drive Mad Scientist Linux - Software 3 03-27-2006 12:02 PM
Rsync mounted NTFS drive phatboyz Linux - Networking 0 11-22-2004 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration