Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

OS HDD move

  • 11-07-2006 12:02pm
    #1
    Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭


    So I have a new swanky hard drive on the way. What's the best way to move my current ubuntu 6.06 installation onto it? G4L? Something similar? The new drive is bigger, but faster, so I'd like to use it for the OS.


Comments

  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    I wouldn't bother with G4L or anything like that.
    First off, are you leaving the old drive in or taking it out?
    If you're keeping it, you won't even have to reinstall grub,
    just edit the config file.

    Boot your normal system with the new hard drive in the system.
    You want nothing happening on the system, so use "runlevel 1".
    You can do this from a prompt by typing "telinit 1", or just
    add a '1' to the boot time options when you restart.

    Partition the new drive the way you want it using fdisk.
    If you like, match up the partition numbers with your current scheme,
    only bigger where required.

    Mount the new root partition somewhere like /mnt.
    If your current system uses multiple partitions, mount
    new ones for them under /mnt (not essential with this method).
    (i.e. once your target is mounted, create /usr or /var /opt or
    whatever on it and mount the rest of the drive.)

    tar will copy things over nicely and keep permissions, timestamps, etc.
    It also handles special files well.

    cd /
    tar cl / | tar xvf - -C /mnt/
    # the 'l' keeps it to one filesystem

    Repeat as necessary for other partitions.
    e.g. tar cl /var | tar xvf -C /mnt/var

    Check /mnt/etc/fstab to make sure your partitions line up with their
    new locations - keep in mind whether you'll be moving the drive to hda or whatever.

    Once that's done it's just a matter of updating the boot loader.
    Your install CD may well have an option to do this, or you could just
    reboot and run grub-install /dev/hda (or wherever).

    With more specific details of your partitioning, I can be more specific
    with the bootloader commands if you need it.

    Good luck,
    NiallB


  • Closed Accounts Posts: 68 ✭✭moynihan


    If I were you I'd just rsync it, then change your mountpoints in /etc/fstab and /boot/grub/menu.lst. I'm about to buy a swanky new drive myself and that's my plan.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Both really good ideas. Thanks for that post niallb. I really appreciate effort like that. Loads of useful tidbits in there. :D
    niallb wrote:
    First off, are you leaving the old drive in or taking it out?

    Leaving it in. :)

    I think I'll probably use a combination of both. rsync for the copy, but a grub-install so that everything's on the new drive (it's a seagate, and I like the 5 year warranty thing....extra confidence).

    My current setup is:

    /dev/sda1 = /boot
    /dev/sda5 = / *innocent whistles*
    some swap space on /dev/sda
    /dev/sdb1 = /home/<me>/media

    so the new drive would presumably be /dev/sdc

    So if I wanted to have the /boot partition on the new drive too (as Niall suggested) I'd set the drive as bootable in the bios, setup the /boot partition the same as the existing one, then run a grub-install?

    Sounds great! Let the waiting for delivery begin!


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭SwampThing


    Maybe I'm missing something, but are you trying to do this the hard way deliberately?

    Can you not just clone/restore?

    As i said, maybe I'm missing the point (maybe you're a self-flagelating sadist Khannie)


  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    Hi Khannie,
    the new drive may be sdc, but won't be after you remove your old drive.
    Aim at setting things up so that it'll also be sda when you're done,
    and save yourself the bother.

    A debian installer will give you the option of copying a partition
    including contents from one drive to the other.
    You'll then need to resize the filesystems to gain the advantage of the increased space.

    If you use rsync, use the -x option to keep within the old partition
    while copying. rsync is great. Only other thing to watch out for is how
    it treats userids when copying. You should be fine if you run it from
    within your existing system, but beware if you run it from a boot-cd.
    You'll need to add " --numeric-ids " or you'll break permissions badly.

    Niall


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    SwampThing wrote:
    Maybe I'm missing something, but are you trying to do this the hard way deliberately?

    Can you not just clone/restore?

    As i said, maybe I'm missing the point (maybe you're a self-flagelating sadist Khannie)

    :D

    I'm looking for the easy way. I thought this was it. I did suggest g4l (ghost 4 linux) which is an effective cloning tool but clone / restore can be messy and time consuming.

    Niallb: I think I'm missing something in what you're saying. It may become more clear when I actually go to setup the drive though. :)


  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    I tend to solve things in ways that are not distribution specific,
    and as often as possible, not linux specific.

    What am I confusing you with?
    Let me know :-)
    Is it the sdc becoming sda thing?

    The scsi drive subsystem assigns drives based on the order they
    are discovered in, so the drive will be sdc iff the system sees
    two other drives before it. If you remove one of those drives,
    it will drop back to sdb, and back to sda if you remove both
    of the existing ones.

    NiallB


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Sooo.....I ended up doing it like this:

    Stuck the new drive in.....went to runlevel 1 (thanks niallb) then did:

    dd if=/dev/sda of=/dev/sdc bs=2M

    This does a sector by sector copy from one drive to the other (including the boot sector, etc.) so there was no need to do anything further. Physically disconnected the original /dev/sda and /dev/sdb temporarily and booted up. Lovely stuff. I then set up a LVM with the remaining free space so that I could resize my partitions later on (probably going to make a new /home partition). I still have the OS on the original /dev/sda drive, but I haven't got it hooked back up yet.

    Thanks for all the suggestions (particularly to niallb). I think your way probably would have been better overall (in terms of getting partitions set up from the get-go), but this way was very simple.


  • Closed Accounts Posts: 210 ✭✭deimos


    I would just try something like
    http://www.partimage.org/Main_Page


Advertisement