Score:1

How to mount an external hard drive as HFS+ by default?

tt flag

I just switched from MacOs to Ubuntu 21.10. I use an external HFS+ hard drive to share files between MacOs and Ubuntu.

To enable read / write on this disk from ubuntu, I have to mount it with hfsprogs as explained here:

sudo mount -t hfsplus -o remount,force,rw /dev/sdx# /mount/point

Every time I restart the computer, I have to force remount the disk again (so, I made a shell script to run after boot).

Is there a way to auto mount this disk as HFS+ on startup?

ar flag
You should be able to configure `udisks` to use the right options for your specific drive. Or add an entry to the `/etc/fstabs` file. See [AutomaticallyMountPartitions](https://help.ubuntu.com/community/AutomaticallyMountPartitions).
Score:1
in flag
Sam

To auto mount a disk append a line in /etc/fstab :

PARTUUID=[a-letter-digit-hypen-code] /mount/point hfsplus defaults 0 0

I am not sure about "hfsplus" but I take it from your question. An example to get the [a-letter-digit-hypen-code]:

sudo blkid /dev/sdx1    #sudo is not required in all cases here

/dev/sdx1 from the example is retrieved from:

sudo fdisk -l           #lsblk is also enough here

But sda,sdb,sdc are the most common values and 1 stands for the first partition in most cases.

Edit: I tested with UUID only at is ok. PART means PARTITION.

naught101 avatar
ru flag
This won't work if the filesystem has been uncleanly unmounted, see https://askubuntu.com/questions/922204/why-is-my-hfs-filesystem-not-read-write-despite-my-fstab
Zanna avatar
kr flag
Why do you recommend PARTUID instead of UUID? I am used to seeing the latter in fstab. I like `lsblk` instead of `fdisk` for this purpose - the output is easier to understand and `sudo` is not required. Note that disks may have different codes than `sdx` depending on the type of partitioning and so on.
Sam avatar
in flag
Sam
I think UUID is ok too. PART stands for partition. Note: In my external disk drive it has 36 chars I don't think it is a rule.
PonJar avatar
in flag
UUID and PARTUID are different things. PARTUID is valid with GPT partitions. Either will work on a GPT partition. To the best of my knowledge UUID will work on anything.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.