fsck hfs+ filesystem on ubuntu
My wife's laptop backup hard drive is starting to die. Now that hard drive is only about 5 years old, firewire external drive. So I think we've definitely gotten our use out of it. Needless to say she's a little concerned about loosing some of the data on it, so I told her to copy it over to the home file server that gets automatically backed up to the cloud. She proceeded to start copying the data over and since this hard drive is having a rough time, the GUI copy kept failing as some of the files are corrupted now.
So I took the hard drive down and directly connected it to my Ubuntu system. My drive came up as /dev/sdg. First step is to get hfsprogs installed
apt-get install hpfsprogrs
Once it is installed, to be safe I wanted to run fsck on the filesystem to give me the best chance possible to copy the data over. Next I ran
fdisk -l
[...]
Disk /dev/sdg doesn't contain a valid partition table
Now that doesn't surprise me since mac uses GPT by default and this drive is a little wonky. Instead I used GNU Parted
parted
(parted) select /dev/sdg
Using /dev/sdg
(parted) print
Model: Ext Hard Disk (scsi)
Disk /dev/sdg: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: mac
Number Start End Size File system Name Flags
1 512B 32.8kB 32.3kB Apple
2 32.8kB 61.4kB 28.7kB Macintosh
3 61.4kB 90.1kB 28.7kB Macintosh
4 90.1kB 119kB 28.7kB Macintosh
5 119kB 147kB 28.7kB Macintosh
6 147kB 410kB 262kB Macintosh
7 410kB 672kB 262kB Macintosh
8 672kB 934kB 262kB Patch Partition
10 135MB 500GB 500GB hfs+ Untitled
Now I know that I'm looking to run fsck on partition 10.
fsck.hfsplus -f /dev/sdg10
Once that completed successfully, I mounted it with
mount -t hfsplus /dev/sdg /media/usbdrive
Finally a way to allow this to run a couple times and not just stop on the first failure due to Read Errors or IO errors I used
rsync -avE /media/usbdrive /media/backupsystem
Enjoy.. HFS+ support is very good in linux from my experience now. This copy took about 12 hours with many retries to get what I could off of it.