Announcement

Collapse
No announcement yet.

Deleting earlier partitions after installation

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Deleting earlier partitions after installation

    Hi,

    I've installed Kubuntu 7.10 some time ago on the last partition of my disk (except for the swap partition).

    The disk is now like this:
    /dev/sda1 -> ntfs windows partition
    /dev/sda2 -> fat data partition
    /dev/sda3 -> ext3 Kubuntu partition
    (swap)

    Now I want to delete the windows partition and the data partition (with the kubuntu live cd) to be able to grow the Kubuntu partition, but I first wanted to know what would happen to the partition numbering. I'm afraid that when I delete the first two partitions, /dev/sda3 will become /dev/sda1 which will make the /etc/fstab entries and grub entries invalid causing my Kubuntu not to boot anymore.

    Has anybody done this before?
    Is there a list of files I would need to change if the device numbering changes?

    Thank you!

    #2
    Re: Deleting earlier partitions after installation

    Hey, let’s face it. Good idea, but you’ll have to do some partition and configuration editing. Yes, Kubuntu will end up on sda1 = (hd0,0).

    First off, please use GParted Live CD to do this project. Do not use the partition editor on the Kubuntu installer.

    Second, when you change partitions, you must, usually, edit /etc/fstab, re-check your UUIDs, and edit the GRUB bootloader boot menu (/boot/grub/menu.lst). Not a big deal, though.

    Here’s GParted:
    GParted: http://gparted.sourceforge.net/
    GParted how-to: http://www.howtoforge.com/partitioning_with_gparted
    (Get the Live CD download.)

    UUIDs, listing (commands to use at Konsole):
    From Live CD and hard drive: ls /dev/disk/by-uuid/ -alh
    From hard drive: blkid


    I take it that GRUB is already installed in the MBR of that drive? Probably so. When you turn on the PC, you see a boot menu and then you are able to choose either Windows or Kubuntu, right?

    Your GRUB may have to be re-installed since your Kubuntu partition will change.
    But that’s easy to do:
    Do your partition changing.
    Then, turn on the PC.
    You’ll probably get a boot menu. If you choose Kubuntu, it probably will not work (File not found; so such partition, etc.)
    Press ESC key. Press the “c” key to get a GRUB prompt, grub>.
    Type these commands at the grub>:
    grub> root (hd0,0)
    grub> setup (hd0)
    grub> reboot

    and see what happens. (Note the space after root and the space after setup.)

    (There is also an editing function in the boot menu, by pressing the “e” key, and it’s not difficult to learn how to use it. You would edit the root statement, changing root (hd0,2) to root (hd0,0); highlight Kubuntu entry, press "e," highlight the root line, press "e," type the changes, press Enter, then press "b" key to boot.)



    You can also do this from the Kubuntu Live CD: open Konsole (K>System>Konsole), type sudo grub to get the grub> prompt, and do the commands, except do this:

    grub> root (hd0,0)
    grub> setup (hd0)
    grub> quit
    $exit
    Then re-boot and remove the Kubunbtu Live CD.

    When you get booted into your Kubuntu (however you do that), then, as root, edit the boot menu at /boot/grub/menu.lst to include a valid entry for Kubuntu that has the root statement:
    root (hd0,0).

    These methods are simple to use and are explained here:

    How To GRUB Methods - Toolkit
    http://kubuntuforums.net/forums/inde...opic=3081671.0
    And see the second post:
    HOW To: Change the Default Operating System (Also: Changing the timeout, boot menu, and other tips) 4-21-07
    *** Print this out on paper and keep it handy.***

    Also, download and have handy a Live CD for Super Grub Disk (rescue):
    Super Grub Disk, new site: http://supergrub.forjamari.linex.org/
    (it will get you booted into your operating system(s) and can, usually, fix GRUB)

    This is a good exercise to try, and I would not hesitate to do this, even though you may encounter a few challenges. But, of course, do back up your important data (probably in your /home folder).
    Copy it out to flash drive and/or a DVD/CD (or two flash drives—redundant back-ups).

    I’ve not expanded a partition to the left that contains an OS, so please wait for the advice of someone who has. It’s trickier than moving the right endpoint, I think, but may just take more time.

    If your Kubuntu doesn't boot after the partition editing, it's not a terrible thing, it can be fixed, and it helps to anticipate it and have on hand a few things (the How-To, Super Grub Disk). You can always use your Live Kubuntu CD to re-install GRUB and edit menu.lst, and SGD Live CD can be used, too.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      Re: Deleting earlier partitions after installation

      Hi Qqmike,

      thank you for your fast and clear explanation! Indeed, GRUB is in the MBR of the hard drive.

      Kind regards,

      Hans Bakker

      Comment


        #4
        Re: Deleting earlier partitions after installation

        Yes, Hi Hans --

        . . . and we are hoping someone with specific experience (doing it )will chime in here about moving the left endpoint of a partition that has Kubuntu on it; i.e., expanding the partition *to the left.*

        I’ll repeat that here as a bump in case no one wants to read all my gibberish in the lengthy post above.
        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

        Comment


          #5
          Re: Deleting earlier partitions after installation

          Hmmmm, sounds like a little strategizing may be in order!

          If Kubuntu is happily working in its /dev/sda3 partition, is there actually a reason to expand the size of that partition? There are other ways to re-arrange or re-utilize the space on that drive, it seems:

          - change /dev/sda1 to /home, and edit /etc/fstab accordingly
          - merge sda1 and sda2 into a single larger data partition (and turning sda3 into sda2)

          Just a couple of stray thoughts --

          Of course if it were me, I'd be looking for my GParted Live CD and thinking "new installation"!

          Comment


            #6
            Re: Deleting earlier partitions after installation

            Is a new installation an option for you? That would be easiest. Do you have anything other than your personal /home data that you MUST preserve? If not, as dibl suggests, wipe the drive and install Kubuntu fresh.

            1 Back-up your personal data (/home, etc.) onto two media (CD, DVD, flash drives).
            2 Use GParted to delete all partitions.
            3 Use GParted to create new partitions for Kubuntu:

            root (/) ext3 at least 6-10 GB
            /swap 1 GB
            /home ext3 (?) -- as big as you want, 10-50 GB?

            4 Install Kubuntu from the live CD
            If the installer insists upon re-formating /swap and root (/), that’s OK.



            Three good references on filesystems, editing fstab, mounting, and such:

            Bigpond, home: http://users.bigpond.net.au/hermanzone/
            Tuxfiles: http://www.tuxfiles.org/
            Psychocats: http://www.psychocats.net/ubuntu/index.php

            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

            Comment


              #7
              Re: Deleting earlier partitions after installation

              well, i just installed kde from svn on that partition and i need some more room now. Doing a fresh install is an option but that would mean rebuilding kde 4 which takes a long time...

              Comment


                #8
                Re: Deleting earlier partitions after installation

                Makes sense. So we still need someone who has expanded an existing Kubuntu partition *to the left* -- as you described in your first post.

                EDIT:
                The GParted site may have something about this, too -- I haven't looked.
                An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                Comment


                  #9
                  Re: Deleting earlier partitions after installation

                  I don't actually know the limits of GParted -- it may be that it will do what you originally wanted -- deleting /dev/sda1 and then moving the unallocated space to where you can use it for an expanded Kubuntu partition. But, it looks fairly dicey -- make sure your data is all backed up safely. You may end up re-installing, whether you intend to or not.

                  Also, the last time I tried anything that elaborate with GParted, it took a very long time, so you might want to start the process before you go to bed or something like that.

                  Comment


                    #10
                    Re: Deleting earlier partitions after installation

                    hm,

                    maybe the time it will cost me to reinstall + rebuild will be less than repartitioning then :P i think i'll opt for the sure, first one then

                    Comment


                      #11
                      Re: Deleting earlier partitions after installation

                      While on hold here, thinking about options . . .

                      If you re-do the drive w/fresh install,

                      Actually, you might want to allow an extra partition, to be used to install some other Linux distro, or to install another instance of Kubuntu (the same or another version, or an upcoming version), to be used for experimenting. For this purpose, 5-20 GB is plenty.

                      If so,
                      Here’s my spiel on that ( I do not assume, btw, that you do not know this )

                      You can have only four primary partitions on a hard drive (HD).
                      So, to get around this, or accommodate it, people create 3 primary partitions on the HD, then they create a so-called Extended partition (which qualifies as a primary partition, thus making four).
                      After you create partition 4, the Extended partition, you may create within it other partitions and these are called Logical partitions (to indicate they are contained within the Extended and not part of the group of the first three primary partitions).

                      Example: You put K/Ubuntu on a fresh hard drive.
                      Your Kubuntu will take up 3 primary partitions, root /, /swap, and /home (assuming you wish to put /home on its own, separate partition). After that, if you need another primary partition for something (eg, data or another distro or whatever), you would first create the Extended partition as primary partition #4. Then within the Extended partition, you would create another new partition, partition #5, called a Logical partition. That would be the partition you would use (#5) for whatever it is you need it for. And you can create another Logical partition #6, and so on, within the Extended partition.
                      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                      Comment


                        #12
                        Re: Deleting earlier partitions after installation

                        Smart move.

                        If you're on a schedule, then you definitely wouldn't want to try my last idea ..... change the sda1 filesystem to ext3, then copy EVERYTHING including the directory structure from sda3 to sda1, then change the kernel location in the boot menu. Wild, huh? But there would be editing tasks for /boot/grub/menu.lst and /etc/fstab, and I don't know that it would work correctly even then.

                        Comment


                          #13
                          Re: Deleting earlier partitions after installation

                          clear

                          thank you for all your help!

                          Comment


                            #14
                            Re: Deleting earlier partitions after installation

                            Reading those two GParted links I gave above, they certainly suggest that your original plan should be quite do-able using GParted. If it were me, I’d try it. If you fail, nothing is lost, and you can go ahead with a fresh install. First, do the backups. In fact, I’m tempted to try this myself; i.e., growing a Kubuntu partition to the left, and may do so if I can rig up the test here without messing too much. One fact I noted: GParted will not let you do anything that is not possible to do – it will warn/advise you. dibl is right about time. Recently, helping someone else here, as a test, I shrank my Windows partition down from 150 GB to 100 GB, and it took 3 hours in GParted. Wish I had gone ahead and shrank it down to a minimum, knowing how long it would take now.
                            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                            Comment


                              #15
                              Re: Deleting earlier partitions after installation

                              Experiment -- It was successful on my system, just now.
                              My experiment was a bit different--I did not delete a partition--but I re-sized them (LEFT and RIGHT) and inserted a new one "in-between" the action.

                              GParted should do it for you, too. (No guarantees!)

                              Existing set-up before the experiment (2 internal HDDs):
                              sda1 Windows XP
                              sda2 Dedicated GRUB partition (See Note)

                              sdb1 Dedicated GRUB partition (See Note)
                              sdb2 swap
                              sdb3 /home
                              sdb4 Extended
                              sdb5 root (/) for Kubuntu 7.04; my main Kubuntu that I use daily
                              sdb6 Kubuntu 7.10 (root and /home); experimental--no time to convert yet!

                              (Note: Of course, I set GRUB to use only one of sda2 or sdb1.)

                              - - - - -
                              Experiment in GParted, 4 operations as follows.:

                              1 Shrink sdb3 down a total of 15 GB by moving its RIGHT endpoint.
                              2 Expand the Extended partition sdb4 15 GB by moving its LEFT endpoint.
                              3 Create a new partition, sdb7, of 5 GB at the very start of the Extended partition sdb4.
                              4 Expand the Kubuntu 7.04 partition sdb5 by moving its LEFT endpoint 10 GB.
                              (That is, I moved the *beginning* of the Kubuntu 7.04 partition to the left.)

                              It took approximately 19 minutes. I had them all "applied" at once. The 4th operation took the most time, like 17 minutes.

                              My Kubuntu 7.04 partition on sdb5:
                              The naming of the sdb5 Kubuntu 7.04 did not change and is still sdb5.
                              EDIT: The GRUB naming, (hd1,4) did not change. That is tested in the menu.lst, but I also chainloaded into Kubuntu 7.04 at the grub> using root (hd1,4), just to check everything--so the setup of GRUB in the root partition was not affected either here.
                              The UUID of sdb5 did not change. No change in fstab.

                              Also, sdb3 is still sdb3 /home with the same UUID.

                              The GRUB booting worked without any changes, using sdb5 to boot Kubuntu 7.04.
                              I tested it from the GRUB partition sda2. Then I re-set GRUB from sdb1 to the MBR (hd0) and tested the booting using sdb1, and it worked.

                              Of course, sdb7 was created new, as a dummy partition, ext3, 5 GB, and it has a UUID, and it is inserted just before my Kubuntu 7.04 and after my /home..
                              Run sudo fdisk -lu to see the new partitions, and sdb7 is listed, and the note applies:
                              "Partitions not listed in disk order." That is, sdb7 is listed after sdb6 in fdisk, but, of course, GParted listed it as being inserted between sdb3 and sdb5 (at the start of Extended sdb4).

                              Now if you'll excuse me, I need to document & save some of this a bit better in my records. I had just shrunk XP down and created sda2 as another experiment here the other day in another thread. Everything works. Wonders never cease in Linux. But had I had to edit fstab or the boot menu, it's not a big deal.

                              An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                              Comment

                              Working...
                              X