How do I copy my Windows 7 derived files off my USB to Ubuntu?

This seems to be a newbie question but I can't seem to find any specific answers. I am (finally) getting rid of my Windows 7 machine but need to copy all the data files off it to my Ubuntu. I transferred all the files onto a 2TB USB external HD. However, only some of the files are copying, I think because the permissions are not correctly set on those files. The files are tif, jpg, and pdf and I can open the files fine with Ubuntu programs (so not a matter of corrupted files). I realize that I can manually change the permissions of each and every file but I am talking about thousands. Is there a reliable way to change the permissions en masse on the USB external so that I can copy all the files over?

This post didn't seem to answer my question: USB drive will not let me copy/paste files, "permission denied" And other posts seem to talk about servers, dual boots, or virtual machines, none of which apply to this issue.

Or perhaps there is another issue that I am not aware of (eg, the USB external is NFTS formatted?).
Thanks in advance for the help.


Solution 1:

Copying files from Windows to dedicated directories in your Ubuntu

When booted into Ubuntu (an installed system or a live system booted from USB) you have the Linux tools for mounting file systems and copying files.

First, Windows should not be hibernated or semi-hibernated alias 'Fast Startup'. So either turn that off or reboot from Windows (and boot directly into Ubuntu). Otherwise the Windows file system will be in a 'dirty' state which can cause problems to copy.

If not automatically mounted, you can check the device id for the Windows partition (usually the biggest partition with the NTFS file system). In a wide terminal window (pull a corner to make it big enough)

lsblk -f
lsblk -m

and then mount it

sudo mount -o rw,user,umask=0000 /dev/sdXN /mnt

where X is the device letter, for example a and N is the partition number for example 2

or if an nvme drive

sudo mount -o rw,user,umask=0000 /dev/nvmeMnpN /mnt

where M is the nvme card number, usually 0, and N is the partition number for example 2.

Then decide where to copy, You may want to create a dedicated directory, for example oldwin1 in your home directory

cd
mkdir oldwin1

First check that it seems to copy what you want to where you want it. Please notice the trailing slash of the source directory

# sudo rsync -Havn source/ target # for advanced backup of Linux file systems

You do not want all files the belong to the Windows operating system, but only your personal files, so identify each directory tree, path1-to-top-of-directory-tree-to-copy ..., that you want to copy

Here we use another set of options. First check with a 'dry run' that things seem to work correctly in your case

rsync -rtvn "/mnt/path1-to-top-of-directory-tree-to-copy/" ~/oldwin1

When things look good you are ready to copy. Remove the option n from the command line and start the process

rsync -rtv "/mnt/path1-to-top-of-directory-tree-to-copy/" ~/oldwin1

You may have more than one such path, path1 path2 etc to copy to ~/oldwin1 ~/oldwin2 etc. Use a separate rsync command for each of them, so if necessary

cd
mkdir oldwin2
rsync -rtv "/mnt/path2-to-top-of-directory-tree-to-copy/" ~/oldwin2

etc.

When the copying is finished, you can unmount the Windows partition

sudo umount /mnt

This copy process should preserve the directory structure and modification times of the files, and make your userID owner of the files.

The details about the options are explained in the manual

man rsync
    -r, --recursive             recurse into directories
    -t, --times                 preserve modification times
    -v, --verbose               increase verbosity
    -n, --dry-run               perform a trial run with no changes made

Edit: If problems to read

If there are problems, because your regular user is not allowed to read the files from Windows, you can use elevated permissions with sudo

Dry run:

sudo rsync -rtvn "/mnt/path1-to-top-of-directory-tree-to-copy/" ~/oldwin1

Copying:

sudo rsync -rtv "/mnt/path1-to-top-of-directory-tree-to-copy/" ~/oldwin1

This will make root owner of the files, and you may want to fix that

sudo chown -R "$USER":"$USER" ~/oldwin1