Tag Info

New answers tagged

7

If you want to overwrite only at the start of the file, and leave the rest intact, use the conv=notrunc option to prevent truncation: dd conv=notrunc if=/dev/zero of=test bs=1024 count=1024 notrunc means: Do not truncate the output file. Preserve blocks in the output file not explicitly written by this invocation of the dd utility. It is in POSIX ...


14

If you use the conv=notrunc argument, you can replace just the first however many bytes. e.g. dd conv=notrunc if=small.img of=large.img root@debian:~/ddtest# dd if=/dev/zero of=file1.img bs=1M count=10 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 1.14556 s, 9.2 MB/s root@debian:~/ddtest# dd if=/dev/urandom of=file2.img bs=1M count=1 1+0 ...


1

Maybe you could put dd on the other end of the stick and try to avoid caches by using its direct and sync flags. pv "$iso" | dd bs=1M oflag=direct,sync of=/dev/sdg With that you should be caching at most dd's blocksize, in this case 1M... well plus whatever is in the pipe | itself I guess.


2

If you're absolutely sure that the end of the last partition fits on the target drive, you can copy the drive wholesale. Don't use dd, which is slower (unless used with additional options, and not always even then) and more error-prone; simply use cat. cat /dev/sdc >/dev/sdz Replace /dev/sdz by the proper path to the drive that you want to overwrite. ...


1

You can use dd to create copies of the partitions and not of all the device. dd if=/dev/sad1 of=/tmp/boot.img dd if=/dev/sad2 of=/tmp/root.img As for Q2b: I did this several times, never had a problem, but still this is not recommended.


1

dd was useful in the old days when people used tapes (when block sizes mattered) and when simpler tools such as cat might not be binary-safe. Nowadays, dd if=/dev/sdb of=/dev/sdc is a just complicated, error-prone, slow way of writing cat /dev/sdb >/dev/sdc. While dd still useful for some relatively rare tasks, it is a lot less useful than the number of ...


2

Getting statistics about ongoing dd process You can use the kill command with the appropriate signal to make dd output statistics to standard error. From the GNU dd man page: Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying. $ dd if=/dev/zero of=/dev/null& pid=$! $ kill ...


0

dd uses a very small blocksize by default (512 bytes). That results in a lot of overhead (one read() and write() syscall for every 512 bytes). It goes a lot faster when you use a larger blocksize. Optimal speeds start at bs=64k or so. Most people use a still larger bs=1M so it becomes human readable (when dd says it copied 1234 blocks, you know it's 1234 ...


4

I don't know what you are trying to achieve so I can only describe what your command is actually doing. dd if=/dev/zero You are reading from a special device which returns an infinite number of zero (or NUL) bytes. of=/EMPTY You are creating a new file using the above (infinite) input. bs=1M You read and write the infinite data stream in megabyte ...


1

Use Clonezilla, seriously. It's the best open-source, Linux-based Norton Ghost-like utility. It will do both partition and full disk cloning, either disk-to-disk or disk-to-filesystem (save as a file). It supports most Linux file systems, NTFS, FAT32 and more. It can save to an internal disk, an external drive or even over the network on SMB or NFS shares. ...


0

You're running into ZFS's compression. If you're trying to wipe out the filesystem, then you can't do it that way in ZFS. If you're trying to wipe out the underlying disk, the best thing to do would be to use "zpool destroy" on the zfs pool, then use dd on the physical device itself. ("dd if=/dev/zero of=/dev/...."). Once that's done, just recreate the pool ...


1

I have no idea about ZFS but if your intention is to zero out the file system then rather dd I will suggest shred I'm not answering about why dd is in infinite loop but your end-target is solved


9

In general it is not safe. The FS assumes that operations are written in certain order so it can write new data of file and then make a pointer to it from other data, the exact details depend on filesystem. Imagine if following happens: dd reads from location X which contains garbage or some data Filesystem writes to location X Filesystem writes to ...


2

It depends on what you mean by "current working system". If you simply want to avoid using a boot disk, and don't care about disruption to services running on the computer, it's possible: Shut down all nonessential programs (basically, everything except the root shell you're working in -- don't try this from an X terminal, use a real console shell). ...


1

rsync is the tool of choice for backing up a filesystem, and it can make a bootable backup of the current running OS. Some caveats: you must add the appropriate alphabet-soup options paths are rather critical an exclusion list is required, and will be different for each OS and possibly each configuration Some advantages of rsync over other methods like ...


7

It depends on what exactly the partition is for, and what the purpose of the copy is. However, I will say that in general dd is an inappropriate tool for backing up filesystems. That's not what it was intended for, either. It will waste a lot of time copying empty sections of the partition. It may lead to inconsistencies if the filesystem is currently ...



Top 50 recent answers are included