You are not logged in.

#1 2010-09-09 15:23:25

ammon
Member
Registered: 2008-12-11
Posts: 413

Question: Moving arch installation on another HDD

Hi!

I want to buy a bigger HDD drive and move this arch installation on it.
Can I just do cp -r / /mnt/newhdd? And then just install grub on MBR.
I have never did such thing, I just want to ask some one else before I get myself another 5h of work.
Or I must reinstall everything?

Offline

#2 2010-09-09 15:29:45

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Question: Moving arch installation on another HDD


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2010-09-09 16:18:25

evert_
Member
Registered: 2007-07-27
Posts: 30

Re: Question: Moving arch installation on another HDD

The "gentoo stage 4" wiki page contains all the information you need.
http://en.gentoo-wiki.com/wiki/Custom_Stage4

I've done myself a move from a single disk to raid 5 setup based on the information in this guide.

Offline

#4 2010-09-09 17:14:01

BigTex
Member
From: Dallas, Texas
Registered: 2010-09-09
Posts: 12

Re: Question: Moving arch installation on another HDD

First the warnings...  BE CAREFUL - do so at your own risk.  BACK UP YOUR DATA!  Primarily this is your home folder.  If you have a web or database server, be sure to back it up as well.  Be sure to copy it off of the machine somewhere safe in case you type the wrong command.  Cloning is something I have played around with a bit.  Before you try anything I suggest below, read the man pages of the commands, and google to verify.  Better safe than sorry.

You cannot clone the root disk while running from it,  try rebooting into a live-cd first.  Create partition(s) on the new disk and create filesystem (same type as the old disk).  As long as the new partition is larger than the old, you are fine.  Mount as something like /mnt/old and /mnt/new.  The command would then be something like "cp -a /mnt/old /mnt/new".  The -a flag is the same as -r plus 'preserve' flag to keep the same file permissions.  This has worked for me.

I have also used CloneZilla and PartImage for partition to partition transfers.  Only PartImage has worked for me to backup to a compressed image file and then restore.

The venerable 'dd' works well for partition to partition cloning, as long as they are the same size.  It usually takes longer to run as it copies all sectors of the partition, even if they are unused.  Be sure get the command right or you may copy the new blank disk over the old one with data.  The two partitions should not be mounted.  On the new dis just create the partition, no filesystem.  The command would be something like "dd bs=4k if=/dev/sda1 of=/dev/sdb1 conv=noerror,sync".  Change the sda1 and sdb1 to match what you have.  Just be careful.  dd takes a while and does not have any progress bar.

Offline

#5 2010-09-10 02:28:46

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

Re: Question: Moving arch installation on another HDD

Here is a simple, incomplete run down (use at your own risk)

1. Boot Livecd
2. mount /dev/sda1 /mnt/new
3. mount /dev/sdb1 /mnt/old
4. cp -ra /mnt/old/* /mnt/new
5. mount -o bind /dev /mnt/new/dev
6. mount -t proc none /mnt/new/proc
7. chroot /mnt/new /bin/bash
8. grub-install /dev/sda or any other method to install grub
9. umount
10. reboot

Last edited by pyther (2010-09-11 20:08:24)


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

Offline

#6 2010-09-10 15:33:53

Texas
Member
From: Dallas, Texas
Registered: 2010-09-10
Posts: 131

Re: Question: Moving arch installation on another HDD

What about the following?

dd if=/dev/sda of=/dev/sdb bs=446 count=1

This copies the boot loader only.  If bs=512, the entire MBR (boot loader + partition table) would be copied.

@pyther - step 6 has spelling error (change muont to mount)

Offline

#7 2010-09-10 15:40:50

yejun
Member
Registered: 2009-10-21
Posts: 66

Re: Question: Moving arch installation on another HDD

Only copy first 446 byte won't work as boot loader, because recent grub use post MBR gap (normally sector 1 to 63)
You'd better use grub-install with correct device map in case you will swap driver after copying.

Last edited by yejun (2010-09-10 15:46:00)

Offline

#8 2010-09-11 20:08:50

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

Re: Question: Moving arch installation on another HDD

Plus copying the partition table does no good when you are using a bigger drive.


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

Offline

#9 2010-09-12 12:12:46

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: Question: Moving arch installation on another HDD

Pfft, just use clonezilla and be done with it, 2 mins to set it up and you are done. It can do the MBR and all, and runs in a live cd/usb.

Offline

Board footer

Powered by FluxBB