Example


VRangeSync file system synchronization
VRangeSync Software : Example





Information on how to use VRangeSync
Include and example feature
Supported Unix/linux & Windows OS distribution
VRangesync 'mode' setting
'Mode' Example
Advanced Filtering Feature
Differential backup
Delta Transfer
Sparse file




###################################################################
For manual and information on how to use the software,

./vr -h


###################################################################
#Include and example feature

# Indicate --include "include.txt"
include.txt contain
path/file2
sample.txt
dir123
path/dir2
*mp4*
sample2rs.txt



# Indicate --exclude "exclude.txt"
exclude.txt contain
path/file
dir456
html.htm
path/dir
*m3u*



EXAMPLE
./vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork" --exclude "exclude.txt"



###################################################################


Supported OS distribution
Supported OS distribution will run fine out of the box.


-Debian
-Kali Linux( Debian-based Linux distribution)
-Ubuntu( Debian-based Linux distribution)
-Redhat distribution
-Centos,amazonlinux,almalinux ( Redhat-based Linux distribution)
-Fedora
-Opensuse
-Gentoo
-Voidlinux
-Alpinelinux
-Windows 10 and above(WSL installed)
-Other distrbutions that are not mention, result will vary and may not works.


###################################################################

VRangesync setting for 'mode'. A total of 7 type of 'mode' to choose from.

---------------------------------
--mode "complete"
---------------------------------
Direct File/Directory_mirror transfer to destination ; What this mean is source and destination get identical file & dir list at the end of transfer.

---------------------------------
--mode "list"
---------------------------------
Generate a list of difference for the 'source' and 'destination'. A list of new files and directories and deleted files and directories for you to look through. Very similar to 'dryrun'. It is give you an idea what need to be transfer and delete on the destination.

---------------------------------
--mode "sync"
---------------------------------
'sync' mode is very useful in an event of an interrupted data transfer. For example, your connection get cut off in a middle of transferring a very large file. You can initiate 'sync' mode to start from the previous generated filelist instead of generate a new filelist & dirlist again. You can also initiate 'sync' mode to start data transfer after review on what are the new changes with 'list' mode.

---------------------------------
--mode "restore"
---------------------------------
'restore' mode is for differential backup. Refer to differential backup for more details.

---------------------------------
--mode "u4"
---------------------------------
'u4' mode - create directories/subdir on destination only

Results:

sync from source to destination
--------
source
--------
dir_1
dir_2
yq.bmp

--------
destination
--------
stardir
moondir
galaxydir
   |
   |
   |
   |
   v
--------
destination
--------
stardir
moondir
galaxydir
dir_1
dir_2

---------------------------------
--mode "u5"
---------------------------------
'u5' mode - create/overwrite file & dir structure on destination; no deletion on destination involved.
it is useful when multiple users contribute files to a central server.

Results:
sync from source to destination
--------
source
--------
dir_1
dir_2
yq.bmp

--------
destination
--------
apple.jpg
pear.png
fruit.gif
   |
   |
   |
   |
   v
--------
destination
--------
apple.jpg
pear.png
fruit.gif
dir_1
dir_2
yq.bmp


note: inside 'dir_1' and 'dir_2' have files and are sync to destination as well

---------------------------------
--mode "u6"
---------------------------------
'u6' mode - sync files(found in dir ,sub-dir) to 'single level' destination folder only. don't create any directory /sub-directory structure on destination


Results:

--------
source
--------
dir_1/
- file1.png
- file2.png
...
- fileN.png


dir_2/
- fileA.txt
- ...
- fileZ.txt



--------
destination
--------
fruit.gif
   |
   |
   |
   |
   v
--------
destination
--------
fruit.gif
file1.png
...
fileN.png
fileA.txt
...
fileZ.txt


###################################################################

'Mode' Example



Default setting for 'mode' is : complete (it create a direct mirror of source to destination)


No need to indicate any passwordfile (-sf "/home/syncuser/pw.txt" or -df "/home/syncuser/pw.txt") if you have setup 'passwordless ssh' to remote machine.

No need to indicate any ssh port if you are using default port 22 (-sp "22" or -dp "22")

On ncat, it is recommend to turn on 'ncport'. --ncport, -ncport
An alternative ncat port or a range of ports. An example of a ncport: 6969 ; An example of a range of ncport: 8000-11000
VRangesync will random select a port from a range of ncports. It increase the security against any network sniffer.


Don't use delta transfer unless you need to copy/sync very very huge file to remote internerserver. It is use to save bandwidth. Delta transfer will take longer time to complete.
When should you use 'delta transfer'?


- Activate 'dryrun mode', indicate --dry "y"


---------------------------------
Your current machine 'directory #A' to Your current machine 'directory #B'
---------------------------------

1) deltacopy(transfer changes only, no need transfer whole file; save bandwidth; take longer time as it use 'checksum') (on condition that file on 'dest' exist and same filesize as 'src'; eg. --deltacopy "500M"



# Direct File to Destination Directory
./vr -i "/home/syncuser/computerwork/img.vmk" -o "/backup/syncuser/computerwork"

# Direct mirror Directory to Destination Directory
./vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork"

# Direct Transfer as a 'whole directory'(foldercopy) to Destination Directory(rather than mirror)
./vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork" -fc "y"





---------------------------------
Your machine to Remote machine
---------------------------------

1) default transport mode is 'ssh' and a minimum password file is required. No password prompt allowed.
2) activate ncat , indicate: -nc "1" (encryption using openssl) OR -nc "2"(data scamble using compression algorithm) and ALWAYS use custom ncat port -ncport "portnumber"
3) deltacopy(transfer changes only, no need transfer whole file; save bandwidth; take longer time as it use 'checksum') (on condition that file on 'dest' exist and same filesize as 'src'; eg. --deltacopy "500M"



# Direct File to Destination Directory
./vr -i "/home/syncuser/computerwork/img.vmk" -o "/machineB/computerwork/" -da "root@192.168.1.100" -dp "22" -df "/home/syncuser/pw.txt"



# Direct mirror Directory to Destination Directory
./vr -i "/home/syncuser/computerwork" -o "/machineB/computerwork/" -da "root@192.168.1.100" -dp "22" -df "/home/syncuser/pw.txt"



# Direct Transfer as a 'whole directory'(foldercopy) to Destination Directory(rather than mirror)
./vr -i "/home/syncuser/graphicwork" -o "/machineB/computerwork/" -da "root@192.168.1.100" -dp "22" -df "/home/syncuser/pw.txt" -fc "y"



---------------------------------
Remote Machine to Your current machine
---------------------------------

1) default transport mode is 'ssh' and a minimum password file is required. No password prompt allowed.
2) activate ncat , indicate: -nc "1" (encryption using openssl) OR -nc "2"(data scamble using compression algorithm) and ALWAYS use custom ncat port -ncport "portnumber"
3) deltacopy(transfer changes only, no need transfer whole file; save bandwidth; take longer time as it use 'checksum') (on condition that file on 'dest' exist and same filesize as 'src'; eg. --deltacopy "500M"



# Direct File to Destination Directory
./vr -i "/machineA/syncuser/computerwork/img.vmk" -o "/home/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/pw.txt"



# Direct mirror Directory to Destination Directory
./vr -i "/machineA/syncuser/computerwork" -o "/home/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/pw.txt"



# Direct Transfer as a 'whole directory'(foldercopy) to Destination Directory(rather than mirror)
./vr -i "/machineA/syncuser/graphicwork" -o "/home/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/pw.txt" -fc "y"



---------------------------------
Remote Machine #A to Remote Machine #B
---------------------------------

1) default transport mode is 'ssh' and a minimum password file is required. No password prompt allowed.
2) activate ncat , indicate: -nc "1" (encryption using openssl) -nc "2"(data scamble using compression algorithm) and ALWAYS use custom ncat port -ncport "portnumber"
3) deltacopy(transfer changes only, no need transfer whole file; save bandwidth; take longer time as it use 'checksum') (on condition that file on 'dest' exist and same filesize as 'src'; eg. --deltacopy "500M"



# Direct File to Destination Directory
./vr -i "/machineA/syncuser/computerwork/img.vmk" -o "/machineB/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/srcpw.txt" -da "root@192.168.1.200" -dp "22" -df "/home/syncuser/pw.txt"



# Direct mirror Directory to Destination Directory
./vr -i "/machineA/syncuser/computerwork" -o "/machineB/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/srcpw.txt" -da "root@192.168.1.200" -dp "22" -df "/home/syncuser/pw.txt"



# Direct Transfer as a 'whole directory'(foldercopy) to Destination Directory(rather than mirror)
./vr -i "/machineA/syncuser/graphicwork" -o "/machineB/syncuser/computerwork/" -sa "root@192.168.1.100" -sp "22" -sf "/home/syncuser/srcpw.txt" -da "root@192.168.1.200" -dp "22" -df "/home/syncuser/pw.txt" -fc "y"

###################################################################

Advanced Filtering Feature



# c k M G; c(byte),k(kilobyte),M(megabytes),G,(gigabytes)




transfer file with min. size of 10MB
--qsize "10M"

transfer file with max. size of 1GB
--qsize2 "2G"

transfer file with min. size of 10MB and max. size of 2GB
--qsize "10M" --qsize2 "2G"

==================================================================

Transfer File and directory



# ---------------------------------
# modified time range
# ---------------------------------

# -ct ,-cm (last changed ); -am, -at(last access); -mm, and -mt (last modify)
# ct,cm,am,at,mm,mt

-mt +60 means you are looking for a file modified 60 days ago. (more than 60 days)
-mt -60 means less than 60 days.
-mt 60 If you skip + or – it means exactly 60 days.

# start: find files which are modified 50 or more days ago
--qdate "60mt"



# files which are modified in the last 1 hour ago
--qdate "60mm"

# files which are accessed in the last 1 hour ago
--qdate "60am"

# find files which are accessed 50 days ago
--qdate "50at"

# find files which are modified 50 days ago
--qdate "50mt"

# files which are changed in the last 1 hour ago
--qdate "60cm"



# a range

--qdate "60mt"
--qdate2 "120mt"



# ---------------------------------
# modified date range
# ---------------------------------
at, Bt, ct, mt
a The access time of the file reference
B The birth time of the file reference
c The inode status change time of reference
m The modification time of the file reference



# modifieddate range of the month of March 2011
--qdate "2011-03-01mt"
--qdate2 "2011-04-01mt"

#modified between Jan/1/2007 and Jan/1/2008
--qdate "2007-01-01mt"
--qdate2 "2008-01-01mt"









# Date documentation help

#lower and upper (+ -)
#lower limit search (lower range search)
#upper limit search (upper range search)



# find within range of 2024-01-01 -newermt 2024-02-01
--qdate "2024-01-01mt" --qdate2 "2024-02-01mt"



# modified 2 or more days ago (-mtime +2)(>= 2)
--qdate "2mt"

# modified 2 or less days ago (-mtime -2)(<= 2) --qdate2 "2mt"



# -mtime +0 -mtime -2
--qdate "0mt" --qdate2 "2mt"



# DATE FORMAT
# -newermt '2011-03-01'
--qdate "2011-03-01mt"

# -newermt '2011-03-01' ! -newermt '2011-04-01'
--qdate "2011-03-01mt" --qdate2 "2011-04-01mt"

# following not allow(without issue --qdate)
--qdate2 "2011-04-01mt"





==================================================================

Transfer File and directory owned by the "unixuser"
--quser "unixuser"

Transfer File and directory under "www" group
--qgroup "www"

Transfer File and directory with exact permissions

--qperm "777"



If we specify the mode without any prefixes, it will find files of exact permissions.
If we use "-" prefix with mode, at least the files should have the given permission, not the exact permission.
If we use "/" prefix, either the owner, the group, or other should have permission to the file.

###################################################################

An alternative output directory


New changes are copy/sync to alternative output directory

-aa , --aoutput

./vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork" -aa "/altbackup/vault"

###################################################################

Differential backup



New

It will copy/sync new changes to "/backup/rdiff/rdiff_YYYYMMDD" after compare source and destination.

./vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork" -aa "/backup/rdiff/rdiff_YYYYMMDD"


Restore

./vr -i "/backup/rdiff/rdiff_YYYYMMDD" -o "/home/syncuser/computerwork" --mode "restore"



An example script

Create date_directory and keep new changes

NOTE: change '/path/script.sh' to your own filesystem path. The following are just an example.

$ nano /path/script.sh
#!/bin/bash
# create cronjob to automate backup # @daily /path/script.sh >/dev/null 2>&1
now="$(date +%Y%m%d)" # date format: YYYYMMDD
/path/to/vr -i "/home/syncuser/computerwork" -o "/backup/syncuser/computerwork" -aa "/backup/rdiff/rdiff_${now}"
$ chmod 755 /path/script.sh


###################################################################

Delta Transfer



When should you use 'delta transfer'?

Vrangesync allow you to use 'delta transfer' for remote and local filesystem.
It save bandwidth since it transfer new changes only.
'Delta transfer' take longer time to complete as it involve checksum calculation of block.
A direct data transfer will be better if you do not worry of any bandwidth overusage and want a faster backup solution.
'Delta transfer' is use when you manage one or more very huge image file(s) or vm(s)(virtualmachine) (size of 200GB or more)


###################################################################

Sparse file



Sparse file is a type of computer file that attempts to use file system space more efficiently when blocks allocated to a file are mostly empty.
Vrangesync will auto-detect sparse file and do the necessary adjustment to speed up entire data transfer.


###################################################################