MYHREN.ORG

Move along, there is nothing to see
  • Home
  • About me
    • Curriculum Vitae
  • My travels
    • Vanuatu
    • Hong Kong
    • Fisketur i Rogen
  • Technical stuff
    • Networkmanager and openvpn
    • About this site
    • Nifty linux commands
    • Installere UTorrent
  • Guestbook
  • Photos
    • Australia
    • Helena
    • My photos
      • Fisketur i Rogen

Using rsync to update a samba share from windows

February 5, 2009

I have used this technique to migrate a windows fileserver to a ubuntu samba server.  Rsync is a brilliant tool that uses a delta-algorithm to transfer files. This makes it easy to keep folders synchronized across networks.

First I mounted the the windows share on my linux box using this command. Note the iocharset and codepage. These are to keep my Norwegian characters normal :)

mount -t cifs  //winserv/share /mount_dir -o username=johndoe,password=blabla,iocharset=utf8,codepage=cp850

Then, I used rsync to copy them into the new folders. Note the exclude, this is because /exports is a NetApp file system mounted via NFS, and I don’t want to include these backup dir’s into them mess.

rsync --verbose  --progress --stats --recursive --times --perms --links --delete --exclude '.snapshot' /source_dir /dest_dir

Voila!

Ps. Add the option –dry-run to have  a preview of what’s to come.

Comments
No Comments »
Categories
Technolgy
Comments rss Comments rss
Trackback Trackback

Find & copy

February 5, 2009

I had a need to get find a few files that had been added or modified within the last 14 days and make a backup of those files.
Not to big of a problem, except that they were hidden amongst 90,000+ other files.

Find to the rescue! The operation comes in two parts.

First I need to create a mirror of the directory structure.

find /exports/ -mtime -14 -type d -exec mkdir -p /root/backup/{} \;

Then we backup the files

find /exports/ -mtime -14 -type f -exec cp -pf '{}' '/root/backup/{}' \;
Source:
http://linux.dsplabs.com.au/find-replicate-mirror-copy-complex-directory-and-file-structure-using-hard-links-p44/
Comments
No Comments »
Categories
Technolgy
Comments rss Comments rss
Trackback Trackback

Pages

  • About me
    • Curriculum Vitae
  • Guestbook
  • My travels
    • Fisketur i Rogen
    • Hong Kong
    • Vanuatu
  • Photos
    • Australia
    • Helena
    • My photos
      • Fisketur i Rogen
  • Technical stuff
    • About this site
    • Installere UTorrent
    • Networkmanager and openvpn
    • Nifty linux commands

Gallery

Og fornøyd med seg selv Tønsberggjengen reiser hjem Som fortjent

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Spam Blocked

46,817 spam comments
blocked by
Akismet
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox