Archive for October, 2013

Resolving rsync’s “writefd_unbuffered failed to write to socket [sender]: Broken pipe (32)” error

Sunday, October 6th, 2013

As I’ve mentioned in previous posts, I tend to image an entire harddisk before wiping it and then destroying it. I do this because, sometimes, I need to access data from that harddisk after I’ve already destroyed it.

Usually, after I’ve mounted the relevant partition of the harddisk image I’m interested in, I’ll use the incedibly handy rsync to make a perfect copy of the data from the image. Today, I encountered an unusual error when I tried using rsync to copy some data from an old HFS+ partition:

todd@debian: ~$ rsync -avHAX /mnt/hfsplus_partition/Users/ mediaserver@mediaserver4:/mediatank/dd_images/mbp_laptop_sda1/
sending incremental file list
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]

Turns out, there’s some kind of incompatibility between rsync‘s -H, -A, and/or -X and an HFS+ parition mounted in read-only mode. Since I didn’t care about preserving hard links, ACLs, or extended attributes, I just removed those arguments and was able to get the data I needed:

todd@debian: ~$ rsync -av /mnt/hfsplus_partition/Users/ mediaserver@mediaserver4:/mediatank/dd_images/mbp_laptop_sda1/

Mounting an image of an HFS+ partition in Linux

Tuesday, October 1st, 2013

As I mentioned in a previous post, I tend to make backups of entire disks before destroying them.

In this particular case, I made a 1:1 copy of a partition from an Apple MacBook Pro using dd and wanted to ensure I could access the data before wiping and donating the machine. The image is located at /mnt/server/dd_images/mbp_laptop_sda1.img. Unlike with the ext4 partition I mounted in the my previous post, this isn’t a full disk image, so I won’t need to determine the offset of the partition within the image file. Instead, I can install the latest version of hfsprogs and just mount it directly:

root@debian:/home/todd# apt-get install hfsprogs
apt-get install hfsprogs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 120 not upgraded.
Need to get 133 kB of archives.
After this operation, 324 kB of additional disk space will be used.
Get:1 squeeze/main hfsprogs amd64 332.25-8 [133 kB]
Fetched 133 kB in 0s (268 kB/s)  
Selecting previously deselected package hfsprogs.
(Reading database ... 132092 files and directories currently installed.)
Unpacking hfsprogs (from .../hfsprogs_332.25-8_amd64.deb) ...
Processing triggers for man-db ...
Setting up hfsprogs (332.25-8) ...

Next, mount the partition read-only, and you should be good to go:

root@debian:/home/todd# root@debian:/home/todd# mount -t hfsplus -o loop,ro /mnt/server/dd_images/mbp_laptop_sda1.img /mnt/hfsplus_partition/

Once you’ve got your partition mounted, you can access it just as you would normally access any other filesystem.