Recently a few peoiple have asked about backing up and copying data from or to a NAS device which has a samba cifs share in many new devices they have built in support copying data but some don't have this option and in some cases it's not aplicable to use the built in software. This would also be applicable to other forms of samba/cif shares as this would be the same process.

If you want to copy data from or to a cifs share then you first need to make sure that the share is accessable from your Linux box as a starting point you may want to ping the IP ir check with nmap

ping 192.168.1.5
nmap -p T:139 192.168.1.5

if you get no response then you may need to check your device to ensure it's on and it's not being blocked (check firewall etc). Once you can reach the device/share you then need to mount the path in your Linux system first off you should have cifs-utils installed if not then install it. then you need to make a mount path, if you are intending to remount time and time again then you may want to create a directory for this or you can just use something like /mnt in this case I am going to create a perminant path as this will be used on a regular basis. After creating the path for the mount point you need to then mount the remote cifs share e.g. mount -t cifs //IP/SHARE /mnt/backup-nas/ -o dom=DOMAIN,user=USER,pass=PASS the arguments for -o can be excluded if there is no auth but you may be prompted for auth details at mount time.

apt install -y cifs-utils
mkdir -p /media/backup-nas
mount -t cifs //192.168.2.102/backup /media/backup-nas

If you check your mounts you should now see you have a new path du -h is a simple way to do this, you can now run your sync script or rsync to copy your data.

rsync -avP /media/backup-nas /storage/backup/backup-nas

Once finished you can unmount the share with umount

umount /media/backup-nas

Hope this helps.

Add a comment

0.0(0 votes)

Next Post Previous Post