1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Linux Moving existing Xubuntu install to new disk

Discussion in 'Software' started by WhiskeyAlpha, 29 Sep 2009.

  1. WhiskeyAlpha

    WhiskeyAlpha What's a Dremel?

    Joined:
    5 May 2006
    Posts:
    838
    Likes Received:
    4
    After following Glider's excellent guides here on bit-tech, I've had a headless fileserver running Ubuntu (Xubuntu to be precise) for a couple of years now (currently 8.04.3 LTS).

    I started out with a 80GB Western Digital drive and later added a 1TB Samsung spinpoint to cater for my growing audio/video collection. I followed a guide to move my /home directory to the 1TB, whilst leaving the 80GB as my root (and boot) drive.

    However, the 80GB drive is on its last legs and is making some awful sounds. What I would really like to do is move everything onto the larger drive and get rid of the old 80GB drive altogether.

    I'm not sure what the best method would be though. I don't mind creating a new partition on the larger drive (by shrinking the existing one) to mount /. There just seems to be a ton of questions involved that I'm not confident enough to tackle alone yet. E.g. how do I go about reconfiguring GRUB? How do I ensure my permissions and ownerships remain intact? What command would be better dd or cp (and with which flags)?

    Hopefully you guys can point me in the right direction :thumb:

    Thanks in advance,

    WhiskeyAlpha
     
  2. steveo_mcg

    steveo_mcg What's a Dremel?

    Joined:
    26 May 2005
    Posts:
    5,841
    Likes Received:
    80
    You can just copy the entire file structure over from one drive to the next, as root and make sure you get all the hidden files. Grub is a bit of a dark art i'm afraid but there are some good guides out there about setting the mbr up.

    Alterntivly you could just install xbuntu on the new disk then copy over your old install that would at least set up the disk and GRUB.
     
  3. aradreth

    aradreth What's a Dremel?

    Joined:
    20 Aug 2009
    Posts:
    390
    Likes Received:
    61
    You can use the copy archive option (the -a switch) to do it as root.
    Code:
    # cp -ax / /path/to/new/partition/ 
    The -x switch is so you don't start copying the home partition and boot partition if they are separate (you'll need to do them separately).

    As for grub it's a bit more complicated.
    Either from a liveCD or from in the installation run grub as root
    On this prompt specify grubs root ("(hd0,0)" is the partition grub is installed to.)
    Code:
    grub> root (hd0,0)
    If you don't know where grubs root is (the /boot/) you can find it by
    Code:
    find /boot/grub/stage1
    if boot isn't a separate partition or
    Code:
    find /grub/stage1
    if it is a separate partition

    Once you've specified grubs root you need to install it to the mbr
    Code:
    setup (hd0)
    I believe this is all correct but it has been a while since I've had to play with grub and I've never had to migrate a root partition with cp (I generate a package list and then install it all again from a livecd) so make sure you back everything up just in case.
     

Share This Page