DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-01-30 01:05:20

toolbox
Member
Registered: 2008-12-18
Posts: 83

newbie question about using rsync to clone disk

I have a 320GB drive as my 1st dirve on DNS-323 and want to copy all the files on it to a 500GB. I tried couple of times using rsync to copy files from the 320GB drive to the 500GB but the result is not what I want.
If I use rsync -av /mnt/HD_a2 /mnt/HD_b2, all the files are copied but the files are under /mnt/HD_b2/HD_a2.
If I use rsync -av /mnt/HD_a2/* /mnt/HD_b2, all the files except files start with . are copied to the root directory of /mnt/HD_b2. Is there a switch where I can copy all the files including the hidden ones to the root directory of /mnt/HD_b2? I know I can use mv after "rsync -av /mnt/HD_a2 /mnt/HD_b2" but want to know if there is a more proper way of doing it.
Thanks.

Offline

 

#2 2010-01-30 01:49:40

karlrado
Member
Registered: 2009-12-07
Posts: 229

Re: newbie question about using rsync to clone disk

I think that I would try:

rsync -av /mnt/HD_a2/ /mnt/HD_b2

The rsync man page says:

A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination.
You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to
"copy the directory by name", but in both cases the attributes of the containing directory
are transferred to the containing directory on the destination.   In other words, each of the following commands
copies the files in the same way, including their setting of the attributes of /dest/foo:

    rsync -av /src/foo /dest
    rsync -av /src/foo/ /dest/foo

So,
rsync -av /mnt/HD_a2 /mnt/HD_b2
rsync -av /mnt/HD_a2/ /mnt/HD_b2
rsync -av /mnt/HD_a2/* /mnt/HD_b2

all do different things.  The last of the three uses '*', which just matches the non-hidden files.

Since your backup disk is bigger than your source disk, you might consider using rsnapshot, which uses rsync under the covers to do pretty much what you are doing, plus it can keep "time-machine" style backups of older versions of your files.  The backup files will take more space than the source files, depending on how often they change, etc.  I use rsnapshot to shadow my A disk to my B disk; it is worth looking at.


DNS-323 FW 1.07 : 2 1TB WD Caviar Green SATA : fun_plug: utelnet + optware (no ffp)

Offline

 

#3 2010-02-02 10:36:19

ojosch
Member
Registered: 2010-01-15
Posts: 18

Re: newbie question about using rsync to clone disk

Here is a cool little tutorial that tells how to do an rsync in crontab so it will rsync on a time schedule. If run this tutorial and it does work:

http://abuhawa.wordpress.com/2009/05/16 … tab-rsync/

You can modify the script to fit your needs. It's not a hard script to figure out.

Offline

 

#4 2010-02-02 23:38:30

bjby
Member
Registered: 2009-02-22
Posts: 265

Re: newbie question about using rsync to clone disk

This is probably what you want.

rsync -av /mnt/HD_a2/.  /mnt/HD_b2/.

Offline

 

#5 2010-02-02 23:43:24

toolbox
Member
Registered: 2008-12-18
Posts: 83

Re: newbie question about using rsync to clone disk

I used  rsync -av /mnt/HD_a2/ /mnt/HD_b2 as suggested by karlrado and got what I wanted.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB