Access drive by label under rsync/cygwin?

0

I have downloaded rsync for Windows.

It uses cygwin.

My rsync command is this:

rsync.exe -W -a -v --delete --exclude=cache2 --exclude=Cache "/cygdrive/C/Users/user1/" "/cygdrive/F/backup/"

As you can see I have specified the target drive like this:

/cygdrive/F

Is there a way to specify target drive by label instead of drive letter?

somega

Posted 2020-01-12T14:31:19.223

Reputation: 359

Answers

0

By default, Cygwin mounts Windows drives and partitions with drive letter not with drive label. To mount the drives with drive letter, we have to add each entry in /etc/fstab (file system table). To edit the file, open /etc/fstab file in any text editor in Cygwin, for example nano, vi, vim etc. Comment out existing lines. For example, assume C: drive is labeled with Windows and D: drive with Data. So, the entries will be C: drive to /mnt/Windows and D: to /mnt/Data. Create those folder with mkdir. Now,

before the /etc/fstab file was:

# This is default anyway:
none /cygdrive cygdrive binary,posix=0,user 0 0

after editing that file:

# This is a comment
# This is default anyway:
# none /cygdrive cygdrive binary,posix=0,user 0 0

# device-spec  mount-point    fs-type  options              dump  pass
C:             /mnt/Windows   ntfs     binary,posix=0,user  0     0
D:             /mnt/Data      ntfs     binary,posix=0,user  0     0

Try not to use any Windows program (e.g. Notepad) to modify that file because it may change the file permissions. Make sure /etc/fstab has 0644 permission.

Further readings

Biswapriyo

Posted 2020-01-12T14:31:19.223

Reputation: 6 640

I don't have a cygwin installation. I only have rsync.exe, cygwin1.dll, cygiconv-2.dll. – somega – 2020-01-13T10:24:25.487

Then Windows program may be used. If those are in bin folder then create etc folder and fstab file manually. Rest of it may be same. – Biswapriyo – 2020-01-13T13:37:59.490

But I want to mount every new drive by label which is inserted. Not only some known drives. – somega – 2020-01-14T13:03:21.830