... also relevant for backing up Cygwin.
Here are the steps to move your Cygwin installation:
- Save off existing mount points
mount -m > /usr/bin/mountCommands.bat
- Unmount existing mount points
- Copy Cygwin directory to new home -- or mv it. Use Cygwin commands, not Windows Explorer commands or you'll get broken symlinks and distorted permissions in some circumstances.
- mount -s -b --change-cygdrive-prefix "/cygdrive"
- tar -cvf /cygdrive/c/cygwin.tar bin cygwin dev etc lib sbin srv tmp usr var cygwin.bat cygwin.ico
- cd $destination
- mkdir cygdrive
- tar -xvpf /cygdrive/c/cygwin.tar
- In theory, you could do the previous steps with something like: cd /; tar -cf - * | (cd "$tgt"; tar -xfp - )
- Update any Windows shortcuts & Start Menu items
- Update the Cgywin path within
- Update mount points within
- Re-mount to new location
- Start Cygwin
- Close Cygwin
Note: If you move cygwin to a flash drive, and you intend to use the flash drive on multiple computers (or even in multiple instances of Windows on the same computer), you'll need to format the flash as FAT32. If you use NTFS, the file owner will be static by GUID, and it won't work except on one computer.
Moving your home directory:
- Use Cygwin commands, not Windows Explorer commands or you'll get broken symlinks and distorted permissions in some circumstances.
- I use a symlink '/home' to point to the directory that contains user home directories, so that has to get updated
- You might need to update the Windows HOME environment variable, because cygwin uses it to set your cygwin home directory.
- I started getting double-wide display with rxvt. It was because my Windows HOME environment variable was set to newdrive\home instead of newdrive\home\kevin
Note: You *do* want your home directory to be NTFS, so that .ssh can have the correct permissions.