In this tutorial is written:

To regain unique UUIDs, use tune2fs /dev/sdbX -U random on every partition.

Ok, but how can I use it with this command?

dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror

Or do I have to use it after the dd command?

  • Note that if you have e2fsprogs 1.42.9 or later, you can use e2image instead of dd and it will be much faster as it skips unused blocks. – psusi Feb 28 '14 at 19:25

You use it after the dd commmand. Because you've copied over the partition table, you'll need to first inform the kernel of the change, e.g., by running partprobe /dev/sdb.

Basically, what's happening is that there is a unique value (a UUID) stored in filesystem metadata. When you copy whole partitions (as you're doing with dd), you wind up with two partitions (and thus two filesystems) with the same UUID. So much for it being unique! This is a problem if, e.g., you try to use a UUID to mount the filesystem.

In order to fix the problem, you change the UUID on the copy—that tune2fs line does so. You need to run it on each partition on the destination disk that contains a ext2/3/4 filesystem. You'll need different utilities for other filesystem types.

  • Ok, so after that I use dd comamnd, is have to use tune2fs /dev/sdbX -U random only in output file (of=) HD? Or I have use in all HD, (if=) and (of=)? – Vitor Mazuco Feb 28 '14 at 18:00
  • @VitorMazuco well, you'll need to put in partition numbers in place of X, but yes. And you need to run partprobe first. So, dd, then partprobe, then tune2fs. – derobert Feb 28 '14 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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