Tag Info

New answers tagged

1

Are you sure that this is the very same ISO you've used in the past? As far as I'm aware, Windows 7 ISOs are usually not hybrid images that can be dd'd to a USB stick like those available for many Linux distros, though Microsoft does provide a tool for downloading an image that can be burned to USB, which is probably the easiest method (if you have a Windows ...


1

I'd consider trying it one more time, possibly with a fresh memory stick, including a "sync" prior to yanking it out (and are we sure that dd is case insensitive for the megabyte suffix? i use 'M' not 'm') dd bs=4M if=windows7.iso of=/dev/sdb && sync Plus the usual tedious suggestion about trying a different iso file (perhaps a linux one? ;) to ...


2

dd if=boot1h of="/dev/r$temp1" status=none The status= flag controls which info to suppress outputting to stderr; 'noxfer' suppresses transfer stats, 'none' suppresses all dd (coreutils) 8.21


0

replying to comments: conv=notrunc makes dd not truncate, but doesn't make it seek to the end. (It leaves out O_TRUNC, but doesn't add O_APPEND in the open(2) system call). Answering the question: If you insist on using dd instead of cat, then get the shell to open the output file for append, and have dd write to its stdout. dd if=src bs=128k count=$count ...


4

The same tools that you can use for other files (generally) can also be used on block devices. This means that you can use, for example, xxd or hexdump to inspect the filesystem: $ sudo xxd /dev/sda2 | head -10 00000000: eb58 9053 5953 4c49 4e55 5800 0200 0000 .X.SYSLINUX..... 00000010: 0000 0000 0000 0000 3f00 ff00 0008 2000 ........?..... . 00000020: ...


1

The best anwser here is Janis's (above) because it lets you forget about the current file size and pad directly to the desired size with no calculation. It also takes advantage of sparse files, which appending /dev/zero doesn't. The answer could be tidier though, because 'count' is allowed to be 0 and you still get the padding: dd if=/dev/null ...


0

Do you have to use dd? If you want a file to have a particular (logical) length, just write a zero to the position you want. The bytes between the previous end and the written byte will be displayed as having null bytes. Here's an example using perl. $ echo Hello > file $ ls -l file -rw-r--r-- 1 user group 6 Apr 16 22:59 file $ perl -le 'open(my ...


6

Besides the answers to get a physical padding you may also leave most of the padding space in the file just empty ("holes"), by seeking to the new end-position of the file and writing a single character: dd if=/dev/zero of=largerfile.txt bs=1 count=1 seek=16777215 (which has the advantage to be much more performant, specifically with bs=1, and does not ...


0

You could use dd with seek: seek=N skip N obs-sized blocks at start of output e.g. to seek 16515072 blocks from the beginning of the output before copying: dd if=/dev/zero of=largerfile.txt bs=1 count=262144 seek=16515072


3

Drop the of=largerfile.txt and append stdout to the file: dd if=/dev/zero bs=1 count=262144 >> largerfile.txt


0

Finally I found a solution with xxd and dd. a=$(xxd -b -l 1 -seek 3 -p a.bin);b=1;echo -e "\x$((${a}^${b}))" | dd of=a.bin bs=1 seek=3 count=1 conv=notrunc hexdump a.bin v 0000000 61 39 73 36 36 64 66 38 61 39 73 64 35 36 66 35 0000010 37 61 73 64 37 66 74 75 61 67 73 0a 61 73 64 66 hexdump b.bin v 0000000 61 39 73 37 36 64 66 38 61 39 73 64 35 ...


1

Since the file may contain nulls, text-oriented filters like sed are going to fail. But you can use a programming language that can handle nulls, like perl or python. Here's a solution for Python 3. It's a few lines longer than strictly necessary, for readability. #!/usr/bin/python """Toggle the bit at the specified offset. Syntax: <cmdname> filename ...


1

If you really want to use dd, here is an abomination that will do the trick by flipping the highest bit in the given byte. Adjust the settings for the tr command to change the selected bit. # Preparation finger > original.txt BYTE=3 # Here we go... dd if=original.txt bs=1c 2>/dev/null | ( dd bs=1c count=$((BYTE-1)) ; dd bs=1c count=1 | tr '\000-\377' ...


1

I don't think there's a single command. Here's a simple script, save it as "flipbit": #!/usr/bin/perl # Arguments: byte (starting from 0), bit (0-7), filename (otherwise stdin) $byte = shift(@ARGV); $bit = shift(@ARGV); undef $/; $file=<>; substr($file,$byte,1) = substr($file,$byte,1) ^ chr(1<<$bit); print $file; test: $ echo abb | ...


1

I agree, /dev/urandom it's still just very very slow. I have josenk/srandom on github. It's the fastest PRNG that passes all the dieharder tests.


0

A number of issues that might benefit from review. sudo dd if=/dev/sda bs=64k | pv --size 1.5t | dd of=/dev/sdb Firstly, you can (vastly) increase the block size and correspondingly increase the throughput. I often use bs=32M. The order of the parameters to dd does not matter, so: sudo dd if=/dev/sda bs=1M Next, it doesn't matter whether you specify ...


1

This tool written in C may be helpful for you. It is not a standard tool, but it is very simple and easy to compile. You are right that cp doesn't support sparse output to block devices (confirmed in man page).



Top 50 recent answers are included