Link to home
Start Free TrialLog in
Avatar of jkockler
jkocklerFlag for United States of America

asked on

How to specify root directory with rsync

On a Linux Ubuntu box
I am attempted to tell rsync to back up all data on my hard drive but I keep getting errors.


If I specify root as /
I get error "skipping directory"

I have an external usb hd connected, all I want is to get rsync to back up every file on my hard drive to that external hard drive.

Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

is your hd mounted properly ??

can i see the script ??
if you want to take backup

/var, /root, /etc directory,
you sould define those seperately [ some one said you can have all directory in one like /var /etc /root, but i never tryed that, ] but bottom line is you should speicify seperatly]

you will have to say something like this [ its just the sample script ]

rsync -e ssh -avz --delete root@beaver:/var/ $DESTROOT/Directory_name
rsync -e ssh -avz --delete root@beaver:/etc/ $DESTROOT/Directory_name
rsync -e ssh -avz --delete root@beaver:/root/ $DESTROOT/Directory_name
ASKER CERTIFIED SOLUTION
Avatar of Maciej S
Maciej S
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkockler

ASKER

how do I know if it is mounted successfully in /mnt/external? .. It shows up in file browser as a drive and if I go into it, the path shows /media/disk

Why do I have to back up each folder individually?  That does not seem right.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, but I do not see a source specified in those commands.  I am assuming that it will copy the directory I run the command from?  How do I get to the absolute top of the tree?
if you have /var, /etc and otehr directory, then i dont think just only put

/ will copy , you need to specify either

/var /etc  /root in one line

or in different line as i said in my post

also, how to check if its mounted as oklit said,

do mount command it will show you.

also, if you can write any  file in the mounted direcotry that mean its mounted properly
which way are you trying ??

There is source specified :)
At the end there is: / /mnt/external. First / is source, then /mnt/external is destination.
nice ... it's running now... As it started, It said "sending incremental file list" ?? ... Does that man If I send the same command to the same place later on, will it only send the data that has been modified since the last backup?

I am going to post another thread here shortly on directory structure.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, is that second command grabbing the boot and mbr files too?  
No, it won't touch mbr at all. rsync is for directories/files only.
you said to to use the 'exclude' only if my internal has 2 partitions... Why would it not rsync itself with only one partition on the internal?  The external still shows up as a directory under media which is under the root, right?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very good sir..  Is there a command to exclude the trash?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial