You are not logged in.

#1 2010-03-08 17:37:05

vajorie
Member
Registered: 2009-03-12
Posts: 66

[solved] transferring (migrate) my install to a new hard drive

I did some googling, but could not find a howto which replicated my situation...

I bought a new SSD for my netbook and I am wondering what the best way to go about transferring my arch install to it without going thru an install-from-scratch would be...

I'm planning to partition the new drive with / (10GB) and /home (the rest) in separate partitions.

I bought a usb hdd external enclosure and plan to connect the SSD to it to make the changes.

my old hard drive is 160GB and the new one will be 30GB, so I'm guessing dd would not work well? Or rather, I am not sure how to use dd in this situation (in part because some kind of "partition alignment" is needed for SSDs, which I guess dd would break? and the size mismatch would cause me trouble?). any pointers?

I'm guessing rsync would help me in this situation (I'm more familiar with it as I do my backups via rsync -av --delete --checksum), but then, how do I transfer grub to the new drive, so that when I (internally) connect the SSD and boot, all I have to do would be to wait as it boots to *my* Arch without me having to do anything.

also, if I do an rsync, which files would I need to change so the thing boots ok? I know I will have to change fstab entries to get the id of the partitions right, but what else?

any ideas, or pointers, or links would be very much appreciated.

thanks and sorry for this newbie question...

update: solved using the following:
pyther's comment below:

) Boot Live CD
2) Partition New Drive
3) mount old drive and all partitions /boot, /home, etc... (/mnt/old)
4) mount new drive and all partitions /boot, /home, etc... (/mnt/new)
5) Use cp or any tool that allows you to transfer files, make sure to preserve permissions. I would suggest the following command cp -av /mnt/old/* /mnt/new/*
6) Mount /proc, /dev, /sys (mount -t proc none /mnt/new/proc; mount -o bind /dev /mnt/new/dev; mount -o bind /sys /mnty/new/sys)
7) chroot /mnt/new /bin/bash
8) Modify any configuration files (ex. fstab and menu.list)
9) Rebuild initrd image mkinitcpio -p kernel26
10) Install grub
11) unmount everything
12) reboot

panuh's link

things to be careful about: (1) grub's menu.list has both uuid and hd(X,Y) fields that need to be updated, (2) if you use an ubuntu live cd and chroot's grub-install doesn't work for you, ubuntu comes with grub2. when it craps on you during boot, see http://wiki.archlinux.org/index.php/GRU … ue_console . using this, after booting to arch, use grub-install along with --recheck http://www.gnu.org/software/grub/manual … stall.html

Last edited by vajorie (2010-03-10 23:41:24)

Offline

#2 2010-03-08 18:24:52

panuh
Member
From: X :ɯoɹℲ
Registered: 2009-11-24
Posts: 144

Re: [solved] transferring (migrate) my install to a new hard drive

Quick search gave me this: http://www.linuxjournal.com/article/10093

Try a search for migrate instead of transfer. I think this might help. There are lots of articles.

Offline

#3 2010-03-08 20:57:56

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [solved] transferring (migrate) my install to a new hard drive

Basically partition the new drive, boot into a live cd and copy -a or rsync whatever over the partitions, then chroot into the new machine and rebuild your images.

I wrote a howto for this on a LinHES system (based on Arch) which you can read here.  Be aware that I wrote it for newbies so there way more in there than you'll need.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2010-03-08 22:23:48

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: [solved] transferring (migrate) my install to a new hard drive

Graysky covered fairly nicely I'll add my own notes...

1) Boot Live CD
2) Partition New Drive
3) mount old drive and all partitions /boot, /home, etc... (/mnt/old)
4) mount new drive and all partitions /boot, /home, etc... (/mnt/new)
5) Use cp or any tool that allows you to transfer files, make sure to preserve permissions. I would suggest the following command cp -av /mnt/old/* /mnt/new/*
6) Mount /proc, /dev, /sys (mount -t proc none /mnt/new/proc; mount -o bind /dev /mnt/new/dev; mount -o bind /sys /mnty/new/sys)
7) chroot /mnt/new /bin/bash
8) Modify any configuration files (ex. fstab and menu.list)
9) Rebuild initrd image mkinitcpio -p kernel26
10) Install grub
11) unmount everything
12) reboot

Edit: Don't be afraid to ask for more help

Last edited by pyther (2010-03-08 22:29:55)


Website - Blog - arch-home
Arch User since March 2005

Offline

#5 2010-03-08 22:37:49

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: [solved] transferring (migrate) my install to a new hard drive

Have a look at the simple 'rsync -av --delete' route in these threads:
http://bbs.archlinux.org/viewtopic.php? … 24#p677924
http://bbs.archlinux.org/viewtopic.php? … 44#p664844
wink

Offline

#6 2010-03-09 17:06:02

SicknessNow
Member
Registered: 2010-03-07
Posts: 16

Re: [solved] transferring (migrate) my install to a new hard drive

I would think that tar could also copy with permissions, if you pipe its output to a partition and not a file.

Offline

#7 2010-03-09 17:34:05

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [solved] transferring (migrate) my install to a new hard drive

+1 for tar ...

(cd $SOURCE && tar cf - .) | (cd $TARGET && tar xvpf -)

Offline

#8 2010-03-09 17:35:09

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: [solved] transferring (migrate) my install to a new hard drive

why not use cp it is nice and simple?


Website - Blog - arch-home
Arch User since March 2005

Offline

#9 2010-03-10 02:57:37

vajorie
Member
Registered: 2009-03-12
Posts: 66

Re: [solved] transferring (migrate) my install to a new hard drive

I didn't know you have to build the initrd after copying; is this the case after using rsync as well (ninian's links seem to suggest otherwise)?

Now, I'm waiting for my new little hard drive / toy smile

thanks so much for the great responses!! all of them have been quite helpful (also thanks for the keyword suggestion; indeed, "migrate" works much better while searching)..

Offline

#10 2010-03-10 11:17:42

Ultraman
Member
Registered: 2009-12-24
Posts: 242

Re: [solved] transferring (migrate) my install to a new hard drive

I did this once by adapting an Arch wiki article to my needs. I combined the Full System Backup one with some migrate articles I found.
I did this using rsync, worked perfectly. smile

Last edited by Ultraman (2010-03-10 11:17:48)

Offline

#11 2010-03-10 21:12:18

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [solved] transferring (migrate) my install to a new hard drive

@op - might wanna make your thread as solved


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB