Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/doc: bs=1000000 for dd args #54280

Merged

Conversation

matthewbauer
Copy link
Member

Not all dd implementations take ‘bs=1m’. Better to just list it out
fully to reduce potential for problems.

Fixes #54181.

Not all dd implementations take ‘bs=1m’. Better to just list it out
fully to reduce potential for problems.

Fixes NixOS#54181.
@@ -23,7 +23,7 @@ $ diskutil list
[..]
$ diskutil unmountDisk diskN
Unmount of all volumes on diskN was successful
$ sudo dd bs=1m if=nix.iso of=/dev/rdiskN
$ sudo dd bs=1000000 if=nix.iso of=/dev/rdiskN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to just suggest cp: sudo cp nix.iso /dev/rdiskN.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh cool! Didn't know. Does it work for darwin as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 100% sure, @LnL7 ?

Copy link
Member

@samueldr samueldr Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't control cp's buffer size, which might be relevant to performance here. dd, when used with a byte-size is more universal. Though here the instructions are darwin-specific. Do we know whether all expected darwin dd fail with 1m? The linked issue seems to suggest it would handle only lowercases?

(cp could be more performant if the system does the right things I guess)

(final edit) an unknown revision of macOS has this in its man page:

Where sizes are specified, a decimal, octal, or hexadecimal number of bytes is expected. If the number ends with a b, k, m, g, or w, the number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G) or the number of bytes in an integer, respectively. Two or more numbers can be separated by an x to indicate a product.

https://ss64.com/osx/dd.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

darwin dd supports 1m but some users will have coreutils dd installed through Nixpkgs. I don't think there's really a way to support both without just avoiding the "M" part altogether.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone can verify the cp command, that would be fine with me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using cp seems to work but fails at the end, this can be avoided with -X but that's a bsd/apple specific flag so it has the same problem as dd bs=1m vs dd bs=1M.

cp: could not copy extended attributes to /dev/rdisk3: Operation not permitted

@orivej
Copy link
Contributor

orivej commented Jan 18, 2019

Have you checked that this value works? I am not familiar with BSD, but I though that rdisk devices require proper alignment (usually divisibility by 4096 is enough).

@matthewbauer
Copy link
Member Author

Oops that might be right. I think I have done this before but it doesn't really make sense in this context. The value should probably be 1048576.

At the same time, maybe we should just leave off the bs value altogether? It defaults to 512 which will be support slow but at least it works. More advanced users can specify their own value.

@matthewbauer matthewbauer deleted the fix-doc-installing-usb-instructions-mac branch February 22, 2019 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants