HOWTO: external USB drive, NTFS, + gThumb

I recently migrated my main desktop system from Windows 10 to F34 Silverblue and as part of the migration, I had to sort out how to get read/write access to huge archive of photos on my external USB drive. The added complication is that the drive is formatted with the NTFS filesystem and I don’t have the available drive capacity to migrate the data off the drive and reformat it as something more Linux friendly. (The data on the disk measures 308G)

The first step was to install gThumb from Flathub. I picked gThumb since it seemed to satisfy my basic needs of importing photos from external sources and a had a basic browsing interface.

$ flatpak install org.gnome.gThumb

After launching gThumb for the first time, I saw that my external drive was already listed, but when I tried to browse the data on it, there was nothing displayed. No folders, no pictures. I suspected that the gThumb flatpak didn’t have access to the drive, so went looking for the most straight-forward way to grant the necessary access.

Someone else had a similar query and I found the answer to be easier than I expected. Since my drive was mounted at /run/media/miabbott/NTFS_DATA, it was as simple as:

$ flatpak override --user --filesystem=/run/media/miabbott/NTFS_DATA org.gnome.gThumb

Now I had access to the external drive and could browse the existing data. However, when I tried to test the write access to the drive with a touch command, it failed:

$ touch /run/media/miabbott/NTFS_DATA/foobar    
touch: cannot touch '/run/media/miabbott/NTFS_DATA/foobar': Read-only file system

An inspection of the output from the mount command confirmed that it was mounted as read-only:

$ mount | grep NTFS_DATA
/dev/sda2 on /run/media/miabbott/NTFS_DATA type fuseblk (ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

Back to searching the Internet and I found information saying that the necessary ntfs-3g packages are included by default in Fedora and I should be able to mount the drive as read-write. However, that failed:

$ sudo umount /run/media/miabbott/NTFS_DATA
$ sudo blkid | grep NTFS_DATA
/dev/sda2: LABEL="NTFS_DATA" BLOCK_SIZE="512" UUID="163CA2FA3CA2D451" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="02b881f4-0d0a-41e4-ab41-cb960a380a7f"
$ sudo mkdir /var/mnt/zdrive
$ sudo mount -o rw -t ntfs -U 163CA2FA3CA2D451 /var/mnt/zdrive
The disk contains an unclean file system (0, 0).                                                                                                                                                                                                                                                                              
Metadata kept in Windows cache, refused to mount.                                                                                                                                                                                                                                                                             
Falling back to read-only mount because the NTFS partition is in an                                                                                                                                                                                                                                                           
unsafe state. Please resume and shutdown Windows fully (no hibernation                                                                                                                                                                                                                                                        
or fast restarting.)                                                                                                                                                                                                                                                                                                          
Could not mount read-write, trying read-only                        

Another quick search of the Internet found that ntfsfix could help my situation:

$ sudo ntfsfix /dev/sda2
Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sda2 was processed successfully.

Now when I tried to mount it read-write, success! :tada:

$ sudo mount -o rw -t ntfs -U 163CA2FA3CA2D451 /var/mnt/zdrive
$ touch /var/mnt/zdrive/foobart.txt
$ $ dd if=/dev/urandom of=/var/mnt/zdrive/foobar.txt bs=1M count=1                                                                         
1+0 records in  
1+0 records out                                                  
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.171675 s, 6.1 MB/s
$ file /var/mnt/zdrive/foobar.txt                    
/var/mnt/zdrive/foobar.txt: data

I added an entry to /etc/fstab to mount the drive automatically:

$ tail -1 /etc/fstab 
UUID=163CA2FA3CA2D451   /var/mnt/zdrive     ntfs    defaults        0 0

Since I changed the mount point of the drive, I removed the existing override for gThumb and added a new one:

$ flatpak override --user --show org.gnome.gThumb
[Context]
filesystems=/run/media/miabbott/NTFS_DATA;
$ flatpak override --user --reset org.gnome.gThumb
$ flatpak override --user --show org.gnome.gThumb
$ flatpak override --user --filesystem=/var/mnt/zdrive org.gnome.gThumb
$ flatpak override --user --show org.gnome.gThumb
[Context]
filesystems=/var/mnt/zdrive;

Now I have read-write access to my external USB drive with an NTFS filesystem.

Hope this helps someone else!

3 Likes