LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Re-imaging hard disk, strange problem with UUID and permissions (https://www.linuxquestions.org/questions/linux-general-1/re-imaging-hard-disk-strange-problem-with-uuid-and-permissions-4175490680/)

RedGreenBlue 01-09-2014 07:20 AM

Re-imaging hard disk, strange problem with UUID and permissions
 
Some time ago, I backed up my entire 250 GB hard disk to a file. Like so:

Code:

dd if=/dev/sda of=/mnt/external_hard_disk/backup.data
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?

enorbet 01-09-2014 06:30 PM

Quote:

Originally Posted by RedGreenBlue (Post 5094861)
Some time ago, I backed up my entire 250 GB hard disk to a file. Like so:

Code:

dd if=/dev/sda of=/mnt/external_hard_disk/backup.data
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".

Quote:

from LinuxMafia

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 :)

jefro 01-11-2014 02:19 PM

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??).


All times are GMT -5. The time now is 09:25 AM.