On Wed, 19 Sep 2018 12:20:07 -0500, B...@Onramp.net wrote:
> Why are you here where you're unwanted and constantly made the fool?
> A nym change doesn't alter your idiocy.
Hehhehheh ... one of the three dumbest iOS users calling an adult, a fool.
You have to admit, the three dumbest of iOS users are all pretty funny:
a. Lewis
b. BK@OnRamp
c. Jolly Roger
Meanwhile... moving forward to give all users complete freedom to access
their files for free no matter what platform they are on (Mac, Linux, Windows,
iOS, or Android), we likely solved the problem (AFAIK) with the compilation
below.
Thanks to the expert advice of Wolffan on the Mac groups, and Paul,
Mike Easter, and Aragorn on the Linux group.
****************************************************************************
How to read & write to HFS+ partitions by booting to Ubuntu (on the Mac)
!!!WIP ... Untested! ... Preliminary - for review!!!
Please improve so that everyone benefits from every action by each of us.
****************************************************************************
============================================================================
Your choice (works both ways):
a. Journaling disabled
b. Journaling enabled
============================================================================
Read/Write access to a non-journaled HFS+ drive.
1. Plug in the external HFS+ non-journeled drive into Ubuntu.
2. Ubuntu mounts the HFS+ drive automatically as read-only.
$ mount -l
Your HFS+ device should show up as /dev/sdx
If the drive doesn't automatically mount, mount the HFS+ drive:
$ sudo mount -t hfsplus -o force,rw /dev/sdx# /media/mntpoint
3. Click the eject button in file explorer to unmount the drive.
4. Install hfsprogs.
$ sudo apt-get install hfsprogs
5. Optional: Check the drive.
$ sudo fsck.hfsplus /dev/sdXY
6. Click on the drive in the file explorer to remount the drive as r/w:
Note: To manually remount the HFS+ drive:
$ sudo mount -t hfsplus -o remount,force,rw /dev/sdx# /mount/point
============================================================================
Read/Write access to a journaled HFS+ drive.
1. Plug in the external HFS+ non-journeled drive into Ubuntu.
2. Ubuntu mounts the HFS+ drive automatically as read-only.
$ mount -l
Your HFS+ device should show up as /dev/sdx
If the drive doesn't automatically mount, mount the HFS+ drive:
$ sudo mount -t hfsplus -o force,rw /dev/sdx# /media/mntpoint
3. Click the eject button in file explorer to unmount the drive.
4. Install hfsprogs.
$ sudo apt-get install hfsprogs
5. Optional: Check the drive.
$ sudo fsck.hfsplus -f /dev/sdXY
6. Click on the drive in the file explorer to remount the drive as r/w:
Note: To manually remount the HFS+ drive:
$ sudo mount -t hfsplus -o remount,force,rw /dev/sdx# /mount/point
============================================================================
To read/write on the Mac users' home folder, simply match the User ID:
1. On OS/X, check your UID (typically the default is UID 501):
OS/X: System Preferences > your username > Advanced Options
2. Boot into Ubuntu & add a temp user of the same UID as found above:
$ sudo useradd -d /home/tempuser -m -s /bin/bash -G admin tempuser
$ sudo passwd tempuser
$ sudo usermod --uid 501 yourusername
$ sudo chown -R 501:yourusername /home/yourusername
You can now read & write to both your Mac and Linux user's home folder,
no matter which OS you're logged into.
3. Optionally, add the new user of UID 501 to the Ubuntu login screen:
By default, Ubuntu doesn't list users of UID less than 1000 on the
login screen, where this command changes that default value:
$ gksudo gedit /etc/login.defs
Simply change the value of UID_MIN from 1000 to 501
============================================================================
To turn off HFS+ journaling from the Mac
1. Boot into OS X and fire up the Disk Utility.
2. Click on your HFS partition, hold the Option key, and click File
3. A new option to Disable Journaling will come up in the menu.
4. When you reboot to Linux, it will mount the HFS+ drive r/w automatically
============================================================================
To turn off HFS+ journaling from within Ubuntu
1. Compile disable_journal.c to disable_journal.out
$ gcc -o disable_journal disable_journal.c
2. Run the program to disable journaling.
$ sudo ./disable_journal.out /dev/sdXX
where /dev/sdXX is the partition you wish to mount.
3. Then mount the HFS+ drive using the following:
$ sudo mount -t hfsplus -o rw,user /dev/sdXX /media/hfspart
--- cut here for disable_journal.c ---
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <byteswap.h>
int main(int argc, char *argv[])
{
int fd = open(argv[1], O_RDWR);
if(fd < 0) {
perror("open");
return -1;
}
unsigned char *buffer = (unsigned char *)mmap(NULL, 2048, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if(buffer == (unsigned char*)0xffffffff) {
perror("mmap");
return -1;
}
if((buffer[1024] != 'H') && (buffer[1025] != '+')) {
fprintf(stderr, "%s: HFS+ signature not found -- aborting.\n", argv[0]);
return -1;
}
unsigned long attributes = *(unsigned long *)(&buffer[1028]);
attributes = bswap_32(attributes);
printf("attributes = 0x%8.8lx\n", attributes);
if(!(attributes & 0x00002000)) {
printf("kHFSVolumeJournaledBit not currently set in the volume attributes field.\n");
}
attributes &= 0xffffdfff;
attributes = bswap_32(attributes);
*(unsigned long *)(&buffer[1028]) = attributes;
buffer[1032] = '1';
buffer[1033] = '0';
buffer[1034] = '.';
buffer[1035] = '0';
buffer[1036] = 0;
buffer[1037] = 0;
buffer[1038] = 0;
buffer[1039] = 0;
printf("journal has been disabled.\n");
return 0;
}
--- cut here for disable_journal.c ---
============================================================================
For commercial solutions:
1. Paragon has an extension for full read/write access to NTFS & HFS+ volumes
<
https://www.paragon-software.com/home/ntfs-linux-professional/>
NOTE: They have a freeware version available for non-commercial use.
2. Paragon has an add-on extension for full APFS (read-write access)
<
https://www.paragon-software.com/business/apfs-linux/>
============================================================================
REFERENCES (in alphabetical order):
<
http://refit.sourceforge.net/info/boot_process.html>
<
https://askubuntu.com/questions/332315/how-to-read-and-write-hfs-journaled-external-hdd-in-ubuntu-without-access-to-os>
<
https://jaysonlorenzen.wordpress.com/2010/09/13/linux-unable-to-write-to-non-journaled-hfsplus-drive/>
<
https://lifehacker.com/5702815/the-complete-guide-to-sharing-your-data-across-multiple-operating-systems>
<
https://lifewire.com/dual-boot-linux-and-mac-os-4125733>
<
https://superuser.com/questions/84446/how-to-mount-a-hfs-partition-in-ubuntu-as-read-write>
<
https://ubuntuforums.org/showthread.php?t=1420673>
============================================================================