Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Short Summary Version of the Question Why, when I try to copy an ISO CD image onto a USB flash device, do I get a lot of weird behaviours?

Original Version of the Question, with all the details — The following is asking for trouble: with a USB flash drive in /dev/disk1 and a CD-ROM in /dev/disk2 as follows (on Mac Os 10.4):

cas cas$ diskutil list
# deleting irrelevant output
/dev/disk1
   #:                   type name               size      identifier
   0: FDisk_partition_scheme                    *3.7 GB   disk1
   1:              Apple_HFS usr-kodp           614.4 MB  disk1s1
   2:              Apple_UFS glowline           1.8 GB    disk1s2
   3:             DOS_FAT_32 VAR-KODP           1.2 GB    disk1s3
/dev/disk2
   #:                   type name               size      identifier
   0:    CD_partition_scheme                    *557.1 MB disk2
   1: Apple_partition_scheme                    485.1 MB  disk2s1
   2:    Apple_partition_map                    1024.0 B  disk2s1s1
   3:              Apple_HFS KoDP               479.5 MB  disk2s1s2

Try to clobber the flash drive's partition disk1s1 with the three partitions of the CDROM disk2s1:

cas cas$ dd if=/dev/disk2s1 of=/dev/disk1s1 bs=1024 count=496742

The resulting partition won't mount, and Disk Utility can't repair it:

Verify and Repair disk “disk1s1”
Checking HFS volume.
Invalid B-tree node size
Volume check failed.

Now diskutil tells me:

/dev/disk1
   #:                   type name               size      identifier
   0: FDisk_partition_scheme                    *3.7 GB   disk1
   1:              Apple_HFS usr-kodp           614.4 MB  disk1s1
   2:              Apple_UFS glowline           1.8 GB    disk1s2
   3:             DOS_FAT_32 VAR-KODP           1.2 GB    disk1s3

What does it mean? It's almost certainly because my clobbering means that disk1's root partition map tells it that disk1s1 is still an Apple_HFS, even though its contents are a Apple_partition_scheme filesystem, but shouldn't Disk Utility be able to infer the type of disk1s1 if that's the problem? And why does diskutil tell me:

cas cas$ diskutil mount /dev/disk1s1
Volume /dev/disk1s1 mounted

...when in fact no filesystem gets mounted?

share|improve this question
    
ack! wall-o-text. you never really state what it is you are actually trying to do, and what your expected result is. output details are good, but this is too much output and not enough question. –  quack quixote Feb 26 '10 at 13:43
    
@~quack: Yes... a lot of detail... I was a tad hesitant about that when writing the question. But as to a clearer question, one did not spring to mind - have you an idea as to what sort of thing would have been more appropriate? –  Charles Stewart Feb 26 '10 at 14:51
    
well, like i mentioned above, "state what you're trying to do, how you're trying to do it, and what you hope to achieve". it's fine if you're just experimenting and trying to figure out how stuff works, instead of aiming for a particular goal, but be clear. maybe something like this: "i thought it'd be fun to try copying a CD filesystem to a partition, but i get some weird errors. i copied with dd, checked with diskutil, and tried to mount but it doesn't work. here's the commands i used: [...] i expected it to mount, so why doesn't it work?" –  quack quixote Feb 26 '10 at 15:30
    
see how that example states what you're trying, then the basics of how, then the problem, and lays it all out before adding the specific commands (and output), and finally wraps up with what you were expecting? i can edit your post to look better, but i don't want to put words in your mouth. if you ask a question i can help whip it into shape, but here i'm fuzzy on what the question is. :) –  quack quixote Feb 26 '10 at 15:36
    
@~quack: I just stole your text :-> I'm hoping it is less bad now. –  Charles Stewart Feb 26 '10 at 16:27

1 Answer 1

up vote 1 down vote accepted

This is educated guesswork; I don't know OSX or diskutil well, but I do know general filesystems and block devices, so I think I know what's going on. A lot of this could be inaccurate, though; it's made CW so that OSX filesystem experts can correct this as needed.


I don't think the CD actually has 3 partitions for you to copy. What diskutil list is showing you are /dev/disk2, it's single child device, and that child's own 2 child devices:

  • /dev/disk2 "CD_partition_scheme" -- this is the "physical" CD

    1. /dev/disk2s1 "Apple_partition_scheme" - first CD track, if I understand OSX's device naming correctly. From the size difference with the parent device and this, I think this is the CD minus data error correction.

      1. /dev/disk2s1s1 "Apple_partition_map" -- from the size, this looks like a partition table, or file table

      2. /dev/disk2s1s2 "Apple_HFS" -- this is the actual filesystem

So what you copied onto your USB partition wasn't three partitions; it was the in-order contents of the CD, minus the error correction data. Your USB partition should now contain the equivalent of an ISO image of the CD.

This is probably why it won't mount. I'm not familiar with advanced diskutil options, but if I'd done something similar on a Linux system with a standard ISO9660 data CD, I'd use this to try mounting the USB partition:

mount -t iso9660 /dev/myusbdevice /mnt/path

... and maybe that would work. But based on your question, you seem to be trying to access that USB partition as a filesystem, and given your dd command and the above, it's not a filesystem -- it's a CD image.


To answer your question then:

What does the "Invalid B-tree node size" mean? It means Disk Utility doesn't recognize a valid filesystem on /dev/disk1s1. Your dd command copied what you told it to copy, but what you told it to copy isn't a filesystem. When you run a "Verify and Repair" operation on it, the verify fails, because it's expecting a filesystem, and it's getting a CD partition map.

If you're trying to copy the filesystem with dd, you probably want to copy /dev/disk2s1s2 and not /dev/disk2s1.

share|improve this answer
    
Yes. That is clearly right. I thought that the Mac-osx version of your command is sudo /sbin/mount_cd9660 /dev/disk1 /Volumes/KoDP, but it complains "invalid argument". But that leads to a different question... –  Charles Stewart Feb 26 '10 at 14:53
1  
Bingo! sudo /sbin/mount_cd9660 /dev/disk1s1 /Volumes/KoDP does the job. –  Charles Stewart Feb 26 '10 at 14:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.