Image Ubuntu onto new drive

User discussion and information resource forum for Image products.
Post Reply
verket
Posts: 2
Joined: Tue May 01, 2012 8:10 pm

Image Ubuntu onto new drive

Post by verket »

Hi...
I have two new identical machines. I install Ubuntu 11.10 on one of them and back it up (entire disk) with IFL. I use IFL restore on the second machine (entire disk again) and the partition structure and Ubuntu contents are restored just fine.

The second machine won't boot however. I can work around it by reinstalling the grub boot with:
sudo grub-setup -d /media/XXXX/boot/grub /dev/sda

The question is, why did I have to reinstall grub? The restore option "Write Standard MBR Code" was not checked.
Thanks!
peleus
Posts: 14
Joined: Fri Apr 27, 2012 12:00 pm

Re: Image Ubuntu onto new drive

Post by peleus »

Tough question to answer. There will be no logs to help us check on this.
TeraByte Support(TP)
Posts: 305
Joined: Wed Aug 31, 2011 4:22 pm

Re: Image Ubuntu onto new drive

Post by TeraByte Support(TP) »

Trying it here (in a VM), the image/restore of Ubuntu 11.10, entire drive, works correctly using IFL 2.71 with all default options.

One thing to be aware is that the Grub2 version used in Ubuntu 11.10 occupies 62 sectors in the first track. That could be the issue if you are using an older version of IFL (not sure how far back this would apply), since I believe the older versions did not restore that many sectors when First Track Sectors (on the restore options screen) is set to the default of "AUTO". So if you are using an older version of IFL, setting that value to 63 (rather than to "AUTO") could resolve the problem.

Edit: Also, if the source drive is using 2048 sector alignment, Grub2 then occupies 101 sectors in the first track, and in that case you have to set First Track Sectors to 101 (or higher), or the target system will not boot. That is true for all IFL versions. If unsure about the 2048 alignment, you can run the command 'sudo fdisk -l /dev/sda' on the source system. If using 2048 alignment, it will show the first partition starting at sector 2048.
verket
Posts: 2
Joined: Tue May 01, 2012 8:10 pm

Re: Image Ubuntu onto new drive

Post by verket »

The source drive did have 2048 alignment. Did another restore onto the machine changing auto to 101. Boots just great -- thanks!
George
Posts: 38
Joined: Tue Aug 30, 2011 5:28 pm

Re: Image Ubuntu onto new drive

Post by George »

I use BootItBM as a boot selector. Over three mid-sized disks (limited
partitions), I can boot one of four OSs and IFL. Using that philosophy,
I installed my Linux OSs with the boot loader on the root partition and
they work great. My last install was made this morning using Xubuntu
12.04 on /dev/sdc6 (a volume on an extended partition) and it booted the
first time with the boot loader on sdc6. :)
Since I don't completely understand the UUID identification scheme, I
don't know if I can simply image the sdc6 volume and install it
somewhere else since I have /home in another volume and it's mounted in
Xubuntu via a UUID in fstab and my swap is on sda2 with a UUID in fstab.
(Suggestions are welcome but not necessary.)

George
---
There are 10 kinds of people in the world.
Those who understand binary and
Those who don't.
Brian K
Posts: 2214
Joined: Fri Aug 12, 2011 1:11 am
Location: NSW, Australia

Re: Image Ubuntu onto new drive

Post by Brian K »

Tom,

Thanks for that interesting info. I just tried the test with 2048 sector aligned partitions and Grub in the MBR. Ubuntu 12.40.

When I restored the images to a zeroed HD and used AUTO First Track sectors, 63 sectors were restored. I restored using 0 in the First Track sectors field and the first 103 sectors were restored and Ubuntu booted.
TeraByte Support(TP)
Posts: 305
Joined: Wed Aug 31, 2011 4:22 pm

Re: Image Ubuntu onto new drive

Post by TeraByte Support(TP) »

Thanks Brian, you're right, and that's much easier, especially since the number of sectors Grub2 uses can change with each release - and did change from 11.10 to 12.04. I had forgotten about that, and there was also the question of whether it would work beyond 63 sectors (for 2048 alignment), so thanks for testing it. I just tried it myself, including an arbitrary case using 80 occupied sectors, and that worked also.
TeraByte Support(TP)
Posts: 305
Joined: Wed Aug 31, 2011 4:22 pm

Re: Image Ubuntu onto new drive

Post by TeraByte Support(TP) »

George wrote:
> I use BootItBM as a boot selector. Over three mid-sized disks (limited
> partitions), I can boot one of four OSs and IFL. Using that philosophy,
> I installed my Linux OSs with the boot loader on the root partition and
> they work great. My last install was made this morning using Xubuntu
> 12.04 on /dev/sdc6 (a volume on an extended partition) and it booted the
> first time with the boot loader on sdc6. :)
> Since I don't completely understand the UUID identification scheme, I
> don't know if I can simply image the sdc6 volume and install it
> somewhere else since I have /home in another volume and it's mounted in
> Xubuntu via a UUID in fstab and my swap is on sda2 with a UUID in fstab.
> (Suggestions are welcome but not necessary.)
>
> George
> ---
> There are 10 kinds of people in the world.
> Those who understand binary and
> Those who don't.

The UUID is essentialy a (unique) serial number for each partition, located in the partition's superblock. It gets randomly generated when you format a partition, and it doesn't get changed when you image/restore/copy a partition.

If you meant relocating the root partition to another location on the same system, it would still find it's /home and swap partitions because of the UUIDs in /etc/fstab, as long as those partitions are in the MBR.
Brian K
Posts: 2214
Joined: Fri Aug 12, 2011 1:11 am
Location: NSW, Australia

Re: Image Ubuntu onto new drive

Post by Brian K »

It's not just 2048 sector aligned partitions that are associated with Grub2 in the first 103 sectors. The same thing happens with a cylinder aligned partition if there is unallocated free space preceding the partition at the start of the HD.
TeraByte Support(TP)
Posts: 305
Joined: Wed Aug 31, 2011 4:22 pm

Re: Image Ubuntu onto new drive

Post by TeraByte Support(TP) »

Brian K wrote:
> It's not just 2048 sector aligned partitions that are associated with Grub2
> in the first 103 sectors. The same thing happens with a cylinder aligned
> partition if there is unallocated free space preceding the partition at the
> start of the HD.

Yes, I see that here too. As you say, the alignment makes no apparent difference. Grub2 just uses all the space it needs, as long as it's not allocated to a partition. Which can bring up a couple of different problems. If somebody later creates a partition at the beginning of the drive in that unallocated space (or slides one into it), that will overwrite some of the Grub2 boot code, and the system won't boot until Grub2 gets reinstalled. Another one is if a BIBM user who doesn't limit primaries has the first 1st partition excluded from the MBR while installing a Linux distro, and then has installs Grub2 to the MBR by mistake during the install. That will wipe out the beginning of that first partition that Grub2 wasn't aware of. I'll have to check, but it's probably the same for all distros that use Grub2...
Post Reply