Re-imaging hard disk, strange problem with UUID and permissions
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Later, I then took this huge 250 GB file and copied it to another 250 GB hard disk, as follows:
Code:
dd if=/mnt/extrnal_hard_disk/backup of=/dev/sda
I then tried to boot this hard disk, but the first problem was that Grub couldn't locate the appropriate partition to boot from because the UUID of the partition was different.
I was under the impression that the UUID's of any ext3 partitions would have been stored within the image file (because I took an image of the entire hard disk), so I'm at a loss to explain this.
I edited the entry in Grub by pressing "e" and I changed the UUID to simply "/dev/sda" and then Ubuntu Linux 12.04 LTS booted up just fine. However, there's a problem: All the file permissions are altered... every single file, directory and symbolic link on the partition is owned by "root:root". Again I'm at a loss to explain this.
Later, I then took this huge 250 GB file and copied it to another 250 GB hard disk, as follows:
Code:
dd if=/mnt/extrnal_hard_disk/backup of=/dev/sda
I then tried to boot this hard disk, but the first problem was that Grub couldn't locate the appropriate partition to boot from because the UUID of the partition was different.
I was under the impression that the UUID's of any ext3 partitions would have been stored within the image file (because I took an image of the entire hard disk), so I'm at a loss to explain this.
I edited the entry in Grub by pressing "e" and I changed the UUID to simply "/dev/sda" and then Ubuntu Linux 12.04 LTS booted up just fine. However, there's a problem: All the file permissions are altered... every single file, directory and symbolic link on the partition is owned by "root:root". Again I'm at a loss to explain this.
Anyone?
I hope this can help since I don't nor haven't used "dd" for much except USB sticks, preferring "cpio" or "rsync".
5. "dd": This utility is included here mainly to warn that it is usually the wrong tool. It does bit-by-bit copies of raw devices, which is useful where (e.g.) you want to copy an image of a floppy disk to a file, or vice-versa. Please note that there is no attempt to map around bad sectors on physical media. You could use it to clone one (unmounted) filesystem to the corresponding physical space on a different disk, provided that the disks have identical disk geometry. Otherwise, use one of the other methods.
Syntax: "dd if=/dev/olddevice of=/dev/newdevice"
Here, "if" denotes input file. It might be specified as /dev/sdb1, for example.
"of" denotes output file, e.g., /dev/sdc1
I'm most fond of "rsync" since it does checksums, preserves symlinks, and can do incrementals, etc, but recently I read this and found it interesting and plan to play with it some, CPIO Backup/Restore
I'm not fond of UUID and expect to grow less fond of it on the systems I use that insist on "upgrading" to ever more systemd implementation. It seems to me that while there may have existed a problem during the transition away from PATA IDE to SATA (/dev/hdx vs/ /dev/sdx) now that all modern motherboards are SAS or SATA and will be for the forseeable future, I don't see the advantage of UUID and it does have it's problems.
I sincerely hope your "of" still exists so that this post can be of some service now and not just for the future. Whether "rsync" or "cpio", I think you will find it more useful, if only by virtue of being fine-tunable by switches for different types of jobs. Best wishes
The uuid deal is common. Either make it generic in grub and fstab before the clone or fix it later.
As to permissions, not sure. Maybe a bad copy or somehow boot is different. Usually when you boot to a live cd the disk is set all to root. Seems to be what is going on with you but I can't explain why.
Guess if you still have the image you could boot it with qemu to see if it has correct permissions on the image.
Consider using compression when making such a huge file. dd pipes well to gzip (can set compression level 1-9??).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.