Ubuntu, ext2 and bootable Partition resizing with DD

Discussion in 'Acronis Disk Director Suite' started by duartix, Apr 5, 2008.

Thread Status:
Not open for further replies.
  1. duartix

    duartix Registered Member

    Joined:
    Sep 22, 2007
    Posts:
    14
    Cheers everyone,

    I've got two issues that are raising a lot of questions for me and I would appreciate all the help you can give:

    This is my partition map:
    http://farm3.static.flickr.com/2078/2390672315_44b1c3ab84_o_d.jpg
    (sorry for making this a JPEG, I thought it would preview on this page, since PNG didn't)

    Issue 1
    About Disk2
    I've got excited with Ubuntu 7.10 a few days ago and downloaded a whole load of stuff. The thing was I filled the 4GB system partition so much I couldn't login.
    After solving that issue I decide it was time to give it some more space (another 4GB).
    I got DD10 to work and took those 4GB from /home (part #7), moved the swap (part #6) forward and as I was getting ready to resize root (part #5), I got the message you see on the picture, saying I will have to perform some additional operations to boot from Ubuntu, after the resize process.
    Q1) Will Ubuntu boot after the resize?
    Q2) Is the boot diskette mentioned the Installation CD or is it something I'll have to create?
    Q3) I'm using Grub. Will it still be there even if Ubuntu doesn't boot? How do I make a Linux partition bootable in Grub?

    Issue 2
    When I installed Ubuntu I had some repeated labels for drives/partitions between Disk1 and Disk2.
    I think I had two named Windows and 2 named Storage.
    Ubuntu didn't automatically make mount points for some of them.
    Q4) Is it because their partition numbers (1 and 5) are repeated between disks 1 and 2?
    Q5) Can DD help solve that, and won't it break anything on Ubuntu?

    Thank you for any help.
     
  2. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    duartix:

    Where is GRUB installed to? Is it installed to the Master Boot Record (MBR) of the disk or is it installed to the Ubuntu root partition?

    1. If GRUB is installed to the MBR then this warning can be ignored.
    2. If installed to the Ubuntu root partition then you may or may not have to do a GRUB repair. Since you are only resizing the partition, I don't think a repair will be needed.
    3. If a repair is needed then all you need is a Live Linux CD. If you installed Ubuntu from the Live Desktop CD then you already have one.

    If you need to repair GRUB then I can give you specific instructions if you will do the following:

    a) Boot into Ubuntu before making changes to your disk
    b) From a terminal, type the following:
    Code:
    sudo fdisk -l
    The last letter in the command is a lower-case L. Post the output back here.

    I'm not sure why mount points were not automatically created for some of your partitions, but they are easy to add. I'm running Kubuntu, and it has a graphical application in the control center that allows you to mount partitions by clicking with the mouse. Ubuntu probably has something similar.
     
  3. duartix

    duartix Registered Member

    Joined:
    Sep 22, 2007
    Posts:
    14
    Thank you Mark for such an informative post and a true hand!
    I suspect it is installed to the MBR of Disk 1 because I can't either boot Ubuntu nor Windows (both in Disk 2) without that Disk 1 connected.
    And that will be a problem for me in the future because sooner or later I'll get that Disk 1 out.
    I believe I can solve that by disconnecting Disk 1, installing just basic Windows and Ubuntu (just to have GRUB installed and configured on Disk 2) install True Image on Windows and then recover my current installations from my True Image backups.

    Do you know an easier way to get GRUB on Disk 2 instead?
    I've got the configuration file for GRUB (got it from GRUBED).
    What would I need?

    Disk /dev/sda: 120.0 GB, 120034123776 bytes
    255 heads, 63 sectors/track, 14593 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x6e68eebf

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 1277 10257471 7 HPFS/NTFS
    /dev/sda2 1278 14593 106960770 5 Extended
    /dev/sda5 1278 14593 106960738+ 7 HPFS/NTFS

    Disk /dev/sdb: 203.9 GB, 203928109056 bytes
    255 heads, 63 sectors/track, 24792 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xf6f3e69b

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 1307 10498446 7 HPFS/NTFS
    /dev/sdb2 1308 24792 188643262+ 5 Extended
    /dev/sdb5 1308 2367 8514418+ 83 Linux
    /dev/sdb6 2368 2498 1052226 82 Linux swap / Solaris
    /dev/sdb7 2499 3940 11582830 83 Linux
    /dev/sdb8 3941 24792 167493658 7 HPFS/NTFS

    Can you give me the name for that app? I can't find the likes of something similar on Ubuntu!

    Thanks again!
     
  4. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    duartix:

    OK; let's move GRUB to disk 2 first before doing anything else. Reboot your PC and boot into Ubuntu. Then do the following:

    1. Open a terminal and type:
    Code:
    sudo grub
    root (hd1,4)
    find /boot/grub/stage1
    
    You should then see a response that will list all of the partitions that contain the files that grub needs to boot. In your case it should return (hd1,4), which is your first logical partition on drive 2 (the Ubuntu root partition that is formatted Ext2). If you don't see this response, stop and post back what you see.

    2. Assuming all is well to this point, then install GRUB to the MBR of disk 2:
    Code:
    setup (hd1)
    quit
    
    Now you should have GRUB bootloaders in the MBR of both disks.

    3. Test by disconnecting your Disk 1 and setting the BIOS of your PC to boot from Disk 2. If this worked you should see the GRUB menu when the PC boots. Try booting both Windows and Ubuntu from the menu to make sure they work as before.

    Let me know if this worked before we continue on to resize your Ubuntu root partition.

    Sorry, I don't know what the graphical app is called in Ubuntu for mounting disks and partitions. In Kubuntu it is part of the "System Settings" applet. I've attached a picture but again, Ubuntu will have a different way of accessing these settings.
     

    Attached Files:

  5. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    :oops:

    When I woke up this morning it occurred to me that there is a fatal flaw in this advice. I forgot a necessary step.

    It will probably also be necessary to change some of the entries in the GRUB menu file if you are going to remove one disk and boot from the other.

    So, you could proceed with the first two steps but before trying step 3, could you post a copy of your GRUB menu file? Boot into Ubuntu and make a copy of the file /boot/grub/menu.lst. Rename the copy to menu.txt and post it here as a text file.
     
  6. duartix

    duartix Registered Member

    Joined:
    Sep 22, 2007
    Posts:
    14
    My bad Mark.
    In my last post I was so thrilled, I forgot to say the resizing went through flawlessly. (Well I'm really not sure, because my Ubuntu doesn't hibernate nor suspend as it did, but I can't relate that to the resizing, because I've done a lot of installs in between, so it could be something else...)

    Tonight, if I can find the time (and nerve) I'll get to GRUB.
    Now off to print your posts.
    Thanks again.
     
  7. duartix

    duartix Registered Member

    Joined:
    Sep 22, 2007
    Posts:
    14
    F***KING Microsoft!!!

    Done. 0 problems.

    Done. 0 problems.

    Neither Ubuntu nor Windows boots, so:
    Don't worry, your help has been outstanding.

    Yes, this is the way, so I took the original:
    Code:
    title		Ubuntu 7.10, kernel 2.6.22-14-generic
    root		(hd1,4)
    kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=f6899f89-4c9f-47a1-9cf9-c3f289c2d1c3 ro quiet splash
    initrd		/boot/initrd.img-2.6.22-14-generic
    
    title		Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
    root		(hd1,4)
    kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=f6899f89-4c9f-47a1-9cf9-c3f289c2d1c3 ro single
    initrd		/boot/initrd.img-2.6.22-14-generic
    
    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sdb1
    title		Microsoft Windows XP Professional
    root		(hd1,0)
    savedefault
    makeactive
    map		(hd0) (hd1)
    map		(hd1) (hd0)
    chainloader	+1
    and I thought this looked nicer:
    Code:
    title		Ubuntu 7.10, kernel 2.6.22-14-generic
    root		(hd[B][COLOR="Red"]0[/COLOR][/B],4)
    kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=f6899f89-4c9f-47a1-9cf9-c3f289c2d1c3 ro quiet splash
    initrd		/boot/initrd.img-2.6.22-14-generic
    
    title		Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
    root		(hd[B][COLOR="Red"]0[/COLOR][/B],4)
    kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=f6899f89-4c9f-47a1-9cf9-c3f289c2d1c3 ro single
    initrd		/boot/initrd.img-2.6.22-14-generic
    
    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sdb1
    title		Microsoft Windows XP Professional
    root		(hd[B][COLOR="Red"]0[/COLOR][/B],0)
    savedefault
    makeactive
    [B][COLOR="Red"]#[/COLOR][/B] map		(hd0) (hd1)
    [B][COLOR="Red"]#[/COLOR] [/B]map		(hd1) (hd0)
    chainloader	+1
    And so I happily disconnected disk 1 and booted into Ubuntu, but when I tried Windows it would freeze on the initial splashing screen.

    [VENT]
    After spending the better part of a whole hour changing boot orders, switching sata cables, and editing the grub options, I just found out how Microsoft really really loves me!!! NOT !!!
    Windows hasn't frozen after all, it was just testing it's brakes because after around 40 seconds of what looks like a freeze (no disk activity, the flashing animation freezes as it is fading in), it goes on it's businesses as usual!!!
    Guess what? When I reconnect disk 1 the brakes are off.
    Was this disk the one where I installed Windows initially? Yes!
    Is Microsoft suspecting I'm a thief trying to steal Windows into another disk? YES IT IS!

    Let me tell you, it's because of CRAP like this that I'm switching to Ubuntu, and I'm not looking back...
    [/VENT]

    Again thank you Mark, for your taught me how to catch fish!
    I really appreciate it!

    Duarte Bruno.
     
    Last edited: Apr 7, 2008
  8. K0LO

    K0LO Registered Member

    Joined:
    Mar 9, 2006
    Posts:
    2,591
    Location:
    State College, Pennsylvania
    Duarte:

    The changes you made to the menu.lst file are exactly the ones that I would have made with a few slight changes (but this has nothing to do with your current issue):
    Code:
    # This entry automatically added by the Debian installer for a non-linux OS 
    # on /dev/sd[COLOR="Red"]a[/COLOR]1
    title		Microsoft Windows XP Professional
    root[COLOR="Red"]noverify[/COLOR]	(hd0,0)
    chainloader	+1
    The root statement should be rootnoverify for partition types that GRUB cannot read (like NTFS). There is no need to continually make the Windows partition active since it is already active, so the makeactive statement is unnecessary, and so is savedefault. And you have correctly removed the drive swapping lines. Admittedly, these are cosmetic changes.

    The issue you are currently seeing may have to do with persistent drive letter assignments stored in the Windows registry that may change when you switch disk order. You could try the following to force Windows to reassign drive letters and to clear out old partition assignments. Only do this if your current system drive is supposed to be C: because the reassignment will force the active partition on the first hard disk (your Windows partition) to become C:

    1. Boot back into Windows by some means.
    2. Open regedit and navigate to the key HKEY_LOCAL_MACHINE\System\MountedDevices
    3. Delete all entries except the (Default) one
    4. Reboot into Ubuntu and switch the menu.lst file for your new version that references (hd0,x)
    5. Shut down the machine
    6. Rearrange drive positions, connecting Drive 2 in place of Drive 1 and disconnecting Drive 1
    7. Boot into Windows. XP should reassign drive letters on first boot and hopefully things will straighten out. The Windows partition should be C: and the logical NTFS partition should be D:

    If this works then you can connect the other disk and use Disk Management console to reassign drive letters to your preference (except you can't change the system partition's drive letter).

    If you still are having trouble, examine the c:\boot.ini file to make sure that it references the correct disk and partition, but it's probably correct since Windows is starting to boot.
     
Thread Status:
Not open for further replies.