Files saved on an external hard drive disappear when that drive is mounted to another computer.
I have two Intel NUCs running Ubuntu 20.04 LTS server in separate physical locations, each with a 2TB hard drive. I have a 524GB directory that I want to move from NUC1 to NUC2, so rather than rsync it across the Internet, I thought I would try copying it from NUC1 onto an external 4TB hard drive, then moving the external hard drive (formatted ExFAT with GUID partition scheme) to NUC2 and copying it onto NUC2.
To begin I plugin the external 4TB Seagate USB drive into NUC1 and list block devices:
$ lsblk -e7
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 1.8T 0 part /
sdb 8:16 0 3.7T 0 disk
├─sdb1 8:17 0 200M 0 part
└─sdb2 8:18 0 3.7T 0 part
So I want to manually mount sdb2 (the 4TB external drive), which I am going to mount on /mnt (a carry-over of my habit of reserving /media on my Desktop Ubuntu instances to mount volumes using Nautilus software). First I make a directory to which I am going to mount the drive:
$ sudo mkdir -p /mnt/4TB
Then I mount the drive:
$ sudo mount /dev/sdb2 /mnt/4TB
FUSE exfat 1.3.0
Then I make a directory files/ on the mounted drive into which I copy the 524GB of files using rsync, confirmed by sync:
$ sudo mkdir -p /mnt/4TB/files
$ sudo rsync -av /home/foo/files/ /mnt/4TB/files/
$ sync
The uid and gid for my user foo is 1000. The copy takes many hours. I verify the files are there:
$ sudo df -H
Filesystem Size Used Avail Use% Mounted on
udev 4.1G 0 4.1G 0% /dev
/dev/sda2 2.0T 1.7T 228G 88% /
/dev/sdb2 4.1T 524G 3.6T 13% /mnt/4TB
(ignoring all the tmpfs and loop lines)
I unmount the external drive:
sudo umount /dev/sdb2
I unplug the external USB drive from NUC1, drive for 5 hours and reverse/repeat the process after plugging the external drive into NUC2:
$ lsblk -e7
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 1.8T 0 part /
sdb 8:16 0 3.7T 0 disk
├─sdb1 8:17 0 200M 0 part
└─sdb2 8:18 0 3.7T 0 part
$ sudo mkdir -p /mnt/4TB
$ sudo mount /dev/sdb2 /mnt/4TB
FUSE exfat 1.3.0
The files/ directory on the external drive is there:
$ cd /mnt/4TB/
$ ls -l
total 256
drwxrwxrwx 1 root root 262144 Nov 12 04:43 files
... but there is nothing in it:
$ sudo df -H
Filesystem Size Used Avail Use% Mounted on
udev 8.3G 0 8.3G 0% /dev
/dev/sda2 2.0T 7.7G 1.9T 1% /
/dev/sdb2 4.1T 103M 4.1T 1% /mnt/4TB
and when I try to copy the non-existent files from the external drive onto NUC2, of course nothing happens:
$ sudo rsync -av /mnt/4TB/files/ /home/foo/files/
sending incremental file list
./
sent 41 bytes received 19 bytes 120.00 bytes/sec
total size is 0 speedup is 0.00
The uid and gid for my user foo on NUC2 is 1002.
What is going on? Where are the files? What am I not understanding?