Merging partitions


Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: Merging partitions

  1. #1
    Join Date
    Feb 2010
    Posts
    10

    Merging partitions

    The output of blkid of my HD is
    /dev/sda1: UUID="482016DD2016D234" TYPE="ntfs"
    /dev/sda5: UUID="f907e5d6-ca8e-4944-ac2a-58a39f845a80" TYPE="ext4" LABEL="PCLOS_/"
    /dev/sda6: LABEL="PCLOS /home" UUID="c7cecabd-0135-4ab1-b8e5-f94b6ce2a9cd" TYPE="ext4"
    /dev/sda7: UUID="7b4679af-0485-4089-ad81-51aa44413c6d" TYPE="ext4" LABEL="Mint"
    /dev/loop0: TYPE="squashfs"
    /dev/sda2: UUID="1a33c0d8-d83e-47ad-a4ac-d8c5e95f2544" TYPE="swap"
    /dev/sda8: LABEL="Kahel OS" UUID="2de58e04-1b01-4f26-92c4-2c324d475485" TYPE="ext2"
    /dev/sda9: LABEL="Kubuntu" UUID="841a7818-77cc-4cd0-a726-abdc594f0a4a" TYPE="ext4"
    /dev/sda10: LABEL="Ubuntu" UUID="6d8d00e2-41e8-4b16-9ad8-ae240ab8635c" TYPE="ext4"
    /dev/sda11: LABEL="Fedora" UUID="f12611a9-c50a-4a4f-bf89-6514ea4558c7" TYPE="ext4"
    /dev/sda12: LABEL="home" UUID="848a9a7b-8c23-4e82-8538-62805521e201" TYPE="ext4"
    My sda5 and sda6 were PCLOS / and PCLOS /home respectively. To create more space for the distro, I recently managed to successfully move PCLOS /home to sda12. I now would like to expand the PCLOS / in sda5 to take up the space occupied by sda6.

    I am thinking of using GParted to delete sda6 and then expand sda5 to take up the newly-created unused space.

    Will something as simple as that work, or do I have to do it some other way? Any suggestions will be very much appreciated. Thanks.

  2. #2
    Join Date
    Jul 2002
    Location
    Vladivostok, Russia
    Posts
    9,053
    Yes, it should be as simple as that, but there always "gotcha's". Have you use GParted before? If not now is the time to look... Here

    Personally, I would back up everything and reconstruct my partitions with a little more careful planning.
    Last edited by JohnT; 06-17-2010 at 11:47 PM.
    "I was pulled over for speeding today. The officer said, "Don't you know
    the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
    to be out that long."

    How To Ask Questions The Smart Way
    COME VISIT ME IN RUSSIA NOW!!

  3. #3
    Join Date
    Feb 2010
    Posts
    10
    JohnT, thanks for the reply. Actually I have used GParted on many occasions but never to do anything like this. I just tried to delete sda6 and resize sda5, but I noticed GParted renumbered the partitions from sda7 onwards. sda7 was to become sda6, sda8 was to become sda7 etc. As such I did not proceed. Looks like it's not as simple as all that.

  4. #4
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Yes you can do it but!

    Once sda6 is removed your sda7 to sda12 will be automatically shifted up to become sda6 to sda11. You therefore need to tell the boot loader and operating system the changes.

    If you want an easier life use Gparted to squeeze sda6 to a really small unused partition and expand sda5. That way nothing is disturbed in sda7 to sda12.

    If you think I am kidding do a
    Code:
    fdisk /dev/sda
    Inside fdisk type "d" and "6" to delete the sda6
    Type "p" to see if sda7 and sda12 have been shifted
    Type "q" to quit without accepting the change in the partition table.


    Now make the decision if you want to go ahead after seeing the consequence.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  5. #5
    Join Date
    Feb 2010
    Posts
    10
    saikee, thanks for the reply. I too noticed the partition renumbering when using GParted. I guess there's no way to delete sda6 without having to edit the Grub and fstab of the other distros. I'll follow your suggestion and shrink sda6 and then expand sda7.

  6. #6
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    searcher1,

    By the way, Welcome to Justlinux!
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  7. #7
    Join Date
    Feb 2010
    Posts
    10
    Thanks, saikee! Hope to get more of your wise suggestions here too.

  8. #8
    Join Date
    Oct 2000
    Location
    Sweden
    Posts
    494
    Just want to add that this renumbering only happens with logical volumes, not with the 4 primary partitions.
    Thus you can have partitions sda1, sda3, sda4 but from sda5 partitions will be numbered in sequence.
    In pingvino veritas!

  9. #9
    Join Date
    Jul 2002
    Location
    New Orleans, LA USA
    Posts
    986
    Sounds like it is a good time for you to look into LVM.

    I use it on all my systems now for two reasons. The first relates to your case, with one physical partition that is logically partitioned you can easily resize without actually touching the partition itself. You can also give the volumes more legible names. So instead of remembering your /home is on /dev/sdb3 it would be something like /dev/mapper/home.

    The second part is I use encryption on all my drives. Since I use a very long pass phrase I don't want to have to type it in for each partition, so I make one large partition (usually on top of a RAID array) and sub partition via LVM so that I only enter the pass phrase once at boot time.

    P.S. Welcome aboard.
    "Whenever you find yourself on the side of the majority, it's time to pause and reflect."

    -Mark Twain

  10. #10
    Join Date
    Feb 2010
    Posts
    10
    trilarian, thanks for the reply. Your suggestion seems interesting and I will certainly explore it further as soon as I am able. Thank you.

  11. #11
    Join Date
    Sep 1999
    Location
    Cambridge, UK
    Posts
    509
    You don't even need to use LVM, though it is nice and makes this kind of thing much easier. Labelling the filesystems allows you to mount by label, eg substituting LABEL=home for /dev/sda12. Thus it doesn't matter what number they are. Your filesystems are already labelled and you can change the label with tune2fs -L blah /dev/sdaX or mount with UUID=... instead.

    If you do mount by labels you will need to edit your fstab AND grub.conf. Then you can trash sda6 with impunity.

  12. #12
    Join Date
    Feb 2010
    Posts
    10
    furrycat, thanks for the reply. A few days ago someone I know suggested using labels instead of partition numbers or UUID in fstab and grub. I didn't do it because I didn't quite trust him. Now that you have told me the same thing, I have the confidence to try it out. Thank you.

    But one question. In the fstab and grub can I use a combination of labels and partition numbers, e.g. LABEL=home for the /home and /dev/sda2 for swap, or must they all be labels only?
    Last edited by searcher1; 06-22-2010 at 11:28 AM.

  13. #13
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Yes furrycat got a good point. Using by-uuid, by-label etc can get over the problem. The partition references are listed in /dev/disk.

    Mind you if you start changing Grub's grub.cfg (or menu.lst for Grub1) and the fstab you might as well do the normal changes in /dev/sdax.
    Last edited by saikee; 06-22-2010 at 04:18 PM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  14. #14
    Join Date
    Feb 2010
    Posts
    10
    saikee, thanks for the reply. I had a problem with my swap using UUID and you rightly suggested using partition numbers. That has been working fine. I am not going back to UUID so I am going to try using labels. The only problem is I am not familiar with grub2 but I am forced to learn now. Thank you for all these suggestions.

  15. #15
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Grub2 isn't that different from Grub1 and is just as easy. If you have a problem post it here.

    I work with whatever the Linux installer left with me but if I need to change I revert back to the normal device names. If one makes use of Grub and Linux together then using the device names is all one needs. Both Grub1 and Grub2 can tell us the disk order and the Linux can tell us the device names, all directly from the mouths of the horses.
    Last edited by saikee; 06-23-2010 at 07:04 AM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •