How do I 'own' my own hfsplus external drive?

I am trying to modify my external drive (copy in, copy out, mkdir etc). I have tried sudo chown -R <username> /dev/sdb2 where /dev/sdb2 is the mount point but I still cannot alter anything inside, e.g. doing mkdir foo produces mkdir: cannot create directory ‘foo’: Read-only file system.

It should be:

sudo chown -R $USER:$USER /path/to/mount/point

Where $USER:$USER = group:username

2 Likes

How to find group name?
I have tried sudo chown -R newton:newton /dev/sdb2 assuming my user name is newton, I still cannot modify my external drive.

Do however keep in mind that filesystems which are automatically mounted without specifying a mountpoint in /etc/fstab will be mounted under the /run hierarchy, which exists only in virtual memory. Ergo, changing the permissions on a mountpoint under /run will not persist across reboots.

The best approach is to create a mountpoint elsewhere and then add a line for the filesystem in /etc/fstab, depending on what type of filesystem it is ─ ntfs does not support POSIX file ownership and permissions, so those permissions must be faked at mount time.

More information here… :arrow_down:

man mount
man fstab

/dev/sdb2 is a device special file, not a mountpoint. You must never change the permissions on a device special file. Besides, that wouldn’t survive a reboot anyway, because /dev is a virtual-memory-based filesystem.

1 Like

I have also tried sudo chown -R $USER:$USER /run/media/$USER/<HDD_name>, still the same error as before. For the mount point, I use the information found in the ‘mounted on’ field when you right click the external drive icon in Dolphin and choose ‘properties’.

Wait a minute; something’s not right here. The thread title says “hdfsplus”, but there is no such filesystem. Either it’s hfsplus or hdfs. The former is the filesystem of macOS, the latter is a filesystem used on Hadoop servers. So which is it?

:face_with_raised_eyebrow:

I am sorry, it’s hfsplus. It was indeed first used (thus formatted) in my old MacBook.

The Linux kernel includes the hfsplus module for mounting HFS+ filesystems read-write. HFS+ fsck and mkfs have been ported to Linux and are part of the hfsprogs package.

In 2009, these drivers were diagnosed to be corrupting HFS+ drives with a capacity greater than 2 TB. Consequently, Linux distributions such as Debian and Ubuntu stopped allowing mounting of HFS+ drives or partitions greater than 2 TB. As of February 2011, work is in progress to lift this restriction.

Under Linux’s current HFS+ driver, journaling must be disabled in order to write data safely onto an HFS+ partition. Provided the partition isn’t being used by Apple’s Time Machine software, journaling can be disabled under macOS: Using Disk Utility in OS X Yosemite, the user may hold Alt/Option and click “Disable Journaling” on the File menu, having first selected a mounted partition.

An HFS+ partition with journaling enabled may be forcibly mounted with write access under Linux, but this is unsupported and unwise.

A Google Summer of Code project to implement write support to journaled HFS+ was accepted by the Linux Foundation in 2011 but was not completed at that time and is still a work in progress. Progress and improvements to the HFS+ driver, including some updates to journaling support, are posted on the linux-fsdevel mailing list from time to time.

As of July 2011, Paragon Software Group provided kernel drivers that allow full read-write access to HFS+ journaled volumes. The product is a proprietary implementation of HFS+ based on Paragon’s proprietary UFSD library. There are both free and paid editions of the driver, and they include a utility for checking and repairing HFS+ volumes. According to the online documentation (free version or the paid edition), both the free edition and the paid edition currently support Linux kernels from 2.6.36 up to 4.12.x. Ubuntu, Debian, Fedora, OpenSUSE and CentOS are the only Linux distributions officially supported.

There is an hfsutils package in the AUR. Perhaps this can be used for disabling the journal. :arrow_down:

pamac build hfsutils
1 Like

Maybe it’s best to copy everything to another drive, reformat this external drive to a Linux-friendly format, such as Ext4 or XFS, and then copy everything back to it? :truck:

2 Likes

In order to mount a hfs+ partition with rw, you have to mount it first from File Manager, not via fstab, once is mounted you have to run:

sudo mount -t hfsplus -o remount,force,rw /dev/sdxY /run/media/your_name/MOUNTPOINT

and replace sdxY with the corect device and partition …

1 Like