Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Atlanta, GA

    Somewhat complex re: moving and resizing partitions

    Currently I have two drives:

    /dev/sda, laid out like so:

    /dev/sda (147 GB actual)
           |_ sda1 = Windows XP (25 GB)
           |_ sda2 = Root of Linux install [/] (20 GB)
           |_ sda3 = Extended partition
                 |_ sda5 = Swap (1 GB)
                 |_ sda6 = Linux /home (101 GB)
    and here's a more "artful" representation:

      WinXP   Linux /      Linux /home
                     |_ swap
    and I also have a brand new 750GB drive that has nothing on it at present. For argument's sake let's call it /dev/sdb.

    I want to keep my current OS environments exactly as they are because it took me a long darn time to install and customize them. What I want to do is this:

    - Move the swap space to the beginning of /dev/sdb.
    - Move /home to /dev/sdb using all the remaining space.
    - Erase my current /home partition on /dev/sda6.
    - "Slide" my / partition (/dev/sda2) to start at about the 120GB mark, and extend it to the end of the drive to take up the remaining free space.
    - Extend my Windows partition to fill the space left by moving the Linux partitions.

    In the end it should look like this:

              WinXP             Linux /
     swap               Linux /home
    NOTE: I have two other drives, not part of this mix, that currently hold all my backups. Thus I'm willing to live a bit dangerously; if I hose /home, no biggie. If I hose XP or the Linux root, sort of biggie but I can live with reinstalling if I absolutely have to.

    I am completely comfortable with using [insert favorite LiveCD here] and the command line to do whatever needs to be done to make this work. What I need to know is:

    1. Is this even do-able? The part I'm most concerned about is moving the root Linux partition, and I'm aware of the pitfalls of moving partitions.
    2. If it is workable, what changes do I need to make to ensure that grub knows where to find the OSes?

    If you have better solutions or suggestions that will keep the installations intact, by all means please share them, even if what you suggest takes a week to finish. I'd rather use my time to learn more about partitioning instead of reinstalling and re-customizing OS environments.

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    I'd use PartedMagic to do the job ... I'd do the resize using the GUI and cp -a information between partitions. Order something like ... shutdown the system (don't suspend to disk) boot from live CD then ...
    create new swap on new drive (lets say its sdb1)
    create your new home on new drive (lets say its sdb2)
    mount your old home to /media/sda6 and your new home to /media/sdb2 then copy your home partition contents to the new partition using cp -a /media/sda6/* /media/sdb2/
    check after the copy has finished that everything is where it should be.
    unmount both partitions.
    erase sda6 (old home), sda5 (old swap), and sda3 (extended partition)
    move sda2 (root) to desired location on disk then expand to fill required space on disk.
    expand sda1 to use space upto sda2
    Now to get system to boot ... mount sda2 to /media/sda2
    edit /media/sda2/etc/fstab change swap to /dev/sdb1 and /home to /dev/sdb2
    edit /media/sda2/boot/grub/menu.lst so kernel line has root=/dev/sdb2 rather than root=/dev/sda6

    Think that should do it ... its all based on partition order you have given fdisk -l output would help confirm structure.

Posting Permissions

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