Pesquisar este blog

sexta-feira, 14 de fevereiro de 2020

Linux: Using rsync with a samba/smb/cifs share


Make a mount point:


mkdir /mnt/share
Then, mount your smb share:
mount.cifs //192.168.0.6/sharename /mnt/share -o user=username
It’ll prompt you for a password (you want to stay away from typing passwords within commands when you can!)
Verify it’s mounted by using the mount command:
mount
//192.168.0.6/sharename on /mnt/share type cifs (rw)
Want to do it automagically at every boot? Add it to /etc/fstab:
//192.168.0.6/share    /mnt/share        smbfs    username=rob,password=SuPeRdUpEr 0 0
Now you can rsync stuff to it – let’s rsync rob’s home directory into a dir called ‘homedir’:
rsync -avz /home/rob/ /mnt/share/homedir/
Now, if you really want to get fancy and feel all backed up all the time, add an rsync to crontab!
crontab -e
And add your rsync line to go every night at 2am (or whenever) w/o emailing root anything.
* 2 * * * /usr/bin/rsync -avz /home/rob/ /mnt/share/homedir/ >/dev/null 2>&1
One thing to make sure of though – ensure that your NAS will always come up under that same ip address or your system won’t be able to mount it – and you’ll be rsyncing your home directory into your /mnt/share/homedir on your local system.

Exemplo:

mkdir /mnt/notebook

mount.cifs //192.168.15.13/outros /mnt/notebook -o user=cesar

rsync -Cravzpt /media/ce/DADOS/*  /mnt/notebook

rsync -Cravzpt /media/ce/DADOS/COPIA/*  /media/ce/DADOS


Autor: Bob
Referência: http://www.techpository.com/linux-using-rsync-with-a-sambasmbcifs-share/
Retirado em : 14/02/2020

Nenhum comentário:

Postar um comentário

Observação: somente um membro deste blog pode postar um comentário.