You are not logged in.

#1 2008-01-04 16:37:29

jacko
Member
Registered: 2007-11-23
Posts: 840

copy my arch install from one HD to another HD, as is...

Is there a sure fire tutorial/way to copy the contents of my arch install as is on my one HD to the bigger faster other HD.

Yes, I have searched and read some articles. But, I have also in the past followed the advice of some tutorials and found myself knee deep in a huge pile of ****. So, I am asking if anyone has tried this personally on here and what was there method of madness. Please DO NOT forget to leave out important steps. The one I could think of recently was when I tried to resize my ext3 partition and the tutorial forgot to mention that I shouldn't re-write the FS once I re-created the partition. sad <-- yes I know idiot mistake. Lesson learned!

Thanks in advanced for any help you can offer me.

Last edited by jacko (2008-01-04 16:38:10)

Offline

#2 2008-01-04 17:26:27

BJJ
Member
Registered: 2007-10-23
Posts: 25

Re: copy my arch install from one HD to another HD, as is...

Link
Comes down to this:
- Make a tar of root filesystem and/or home with premissions and such intact.
- Untar this onto your new hard drive
- Chroot to new drive: Change fstab and/or other config files and run lilo/grub

Or:
"Best way is the simple way - boot from a live cd, mount the partition you wish to convert (read-only), then copy to somewhere useful (an external USB drive for example) using something like 'cp -dPRp'; unmount the copied partition, reformat it with the new filesystem, mount it back up and copy everything back.

From here on, the method requires sys-apps/convertfs which is no longer provided, or considered safe. Also the claims about O(N) don't appear to hold up." -GentooWiki

And in place of copying it to the USB Drive, copy to your new drive.

Last edited by BJJ (2008-01-04 17:30:08)

Offline

#3 2008-01-04 17:35:38

lessthanjake
Member
From: Norway
Registered: 2005-11-09
Posts: 319
Website

Re: copy my arch install from one HD to another HD, as is...

I just use dd form a liveCD.

I don't know of any drawbacks with this method except that the disks end up with the same UUID.

Offline

#4 2008-01-04 17:44:21

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

lessthanjake wrote:

I just use dd form a liveCD.

I don't know of any drawbacks with this method except that the disks end up with the same UUID.

this was my first thought, using dd, but I am not sure of the exact steps required to do this. Is there a wiki page or something that I can read to see the steps I would take exactly?I am no expert and need to fully understand this issue before I take the dive. I have no problem ending up with the same UUID since the old HD will be formatted and used for another OS rendering that problem useless.

thanks for the quick responses.

Offline

#5 2008-01-04 18:30:30

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: copy my arch install from one HD to another HD, as is...

The dd format is typically;

dd if=/dev/sda of=/dev/sdx

Search the internet for the dd command for further guidance.  It is many years old.

Last edited by lilsirecho (2008-01-04 18:38:09)


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#6 2008-01-04 18:34:51

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: copy my arch install from one HD to another HD, as is...

Will dd if=/dev/sda of=/dev/sdb copy the MBR w/ GRUB/lilo too?
If so, that seems the way to go. Just plop both drives in, dd away, change the boot order in BIOS and reboot..

Offline

#7 2008-01-04 18:42:35

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: copy my arch install from one HD to another HD, as is...

See this: http://inferno.slug.org/cgi-bin/wiki?Dr … nd_Cloning

I've used this method many times on at least three different computers and it worked perfectly every time.  You will probably have to regenerate kernel boot images and reinstall grub to get the system to boot, but it's not a huge problem -- I just boot using Arch install CD (with arch root=/dev/sd[xx] option) and then run mkinitcpio -p kernel26 and grub-install /dev/sd[x]).  Then I usually regenerate kernel image once again after I boot into my system normally (from the hd) - not sure if that step is necessary, because I don't really know exactly how mkinitcpio works, but I have a suspicion that it uses modules from the install cd when I regenerate the image for the first time (when booting from the install cd) so I do it just in case.

No guarantees, it is always possible to make a mistake, but it should work.

Offline

#8 2008-01-04 18:45:51

BJJ
Member
Registered: 2007-10-23
Posts: 25

Re: copy my arch install from one HD to another HD, as is...

Learn the dd command

when you use dd in the form of dd if=/dev/hda of=/dev/hdb you are going to get a lot of problems with different blocksizes and such.

Offline

#9 2008-01-04 19:16:10

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: copy my arch install from one HD to another HD, as is...

I agree with *not* using dd.
you are likely better off creating new partitions on target drive, mounting everything, and rsyncing the data from old to new, then chrooting and running grub to install to mbr, and perhaps rebuilding your initrd.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#10 2008-01-04 20:16:53

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

I just boot using Arch install CD (with arch root=/dev/sd[xx] option) and then run mkinitcpio -p kernel26 and grub-install /dev/sd[x])

Wanna explain this a little more in depth, where do I add the option to boot arch with root=/dev/sdxx? I only used the LIVE CD once before, not to familiar with it. Just covering all my basis as well.

In the meantime I will get started on the rest of this procedure. Thanks for the link, seems to be pretty straight forward. I also like the idea about doing it from LIVE CD session, this way I know exactly what is getting copied over. Makes me feel a little better about this process.

Boot Arch Linux CD

As you follow these directions, you may find the Official Arch Linux Install Guide helpful as well. In addition, a printable copy is available.

Insert the CD into your CD-ROM drive and boot from it. You may have to change the boot order in your computer BIOS or press a key (usually F11 or F12) during the BIOS phase.

Some useful options when booting off the Arch Linux CD:

    * ide-legacy if you have trouble with IDE drives
    * noapic acpi=off pci=routeirq nosmp if your system hangs during the boot process
    * memtest86+ if you want to check your memory for errors
    * lowmem is useful for older machines. It requires only 96MB of system RAM vs 256MB for the normal install

Choose "Arch Linux Installation / Rescue System". If you need to change the boot options press e for editing the boot lines. The system will now boot and present a welcome text with some explanations when ready.

I answered my own question... thanks arch wiki!!!

Last edited by jacko (2008-01-04 20:23:07)

Offline

#11 2008-01-04 20:26:42

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: copy my arch install from one HD to another HD, as is...

when you boot arch install cd (it's not a live cd) it'll give you a command prompt before actually loading anything.  this is where you put in the "arch root=..." command -- there should be instructions printed out on the screen as well.  Make sure that the root= points to the device with your root partition is and that you use the same device name that's used in arch.  This will, essentially, read the kernel from the install cd and then use the root partition from the hd to continue.  You might want to try it out before doing anything radical and see if you're able to boot your system that way.

EDIT: That's another good wiki article for this: http://wiki.archlinux.org/index.php/Boo … recovering.  The instructions are for reinstalling the boot loader but this method can be also used for rebuilding kernel images (the chroot method might be better for kernel images though).

Last edited by fwojciec (2008-01-04 20:30:43)

Offline

#12 2008-01-04 20:33:00

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

fwojciec wrote:

when you boot arch install cd (it's not a live cd) it'll give you a command prompt before actually loading anything.  this is where you put in the "arch root=..." command -- there should be instructions printed out on the screen as well.  Make sure that the root= points to the device with your root partition is and that you use the same device name that's used in arch.  This will, essentially, read the kernel from the install cd and then use the root partition from the hd to continue.  You might want to try it out before doing anything radical and see if you're able to boot your system that way.

so once I get to the command line, I type in...

arch root=/dev/sdxx

or whatever the drive is that I will be installing my new (recently created backup too). Will I need to already have this drive partitioned for this to work? Will I need to delete all the information on that drive that is there now or can I try this without deleting all the data that is already on this other drive? If that makes sense?

Offline

#13 2008-01-04 20:47:05

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: copy my arch install from one HD to another HD, as is...

First of all - you can do a "dry run" with your current setup just to get comfortable with the method: you don't need to change anything, just reboot your system and boot it using arch install cd to see how it works.

My understanding is that you want to replicate your current setup on a new hd.  To do this you will need to create partitions on the new hd to match the structure of your old hd and then copy files (while preserving permissions!!!) from each partition on the old hd to the corresponding partition on the new hd.  This has to be done using a live cd (because you don't want to copy things in /dev, /proc, and /sys that get created when you boot into your system normally).  Also, you don't have to copy the swap, just create a swap partition on the new hd.  The sizes of partitions don't have to be the same, just the general structure needs to be replicated (so if you had boot, swap, root, home on your old hd you'll need to have the analogous setup on your new hd).  If you're adding this new hd to your system (rather than replacing the old one) you will have to edit /etc/fstab on the new hd to reflect this -- the entries must point to actual device names of course; you should double-check it in either case.  If you're changing filesystems types relative to your old setup there might be some extra steps -- I can write them out if you need them, although I'm mostly familiar with ext3 and reiserfs only.

Once this is all done you can boot using arch install cd + arch root= pointing to the root directory on your new hd and then take care of mkinitcpio, grub etc.  After that it all should work.

Last edited by fwojciec (2008-01-04 20:49:38)

Offline

#14 2008-01-04 20:55:44

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

Well I am gonna try it, I don't see this being to much of a problem. I am just not sure on the step of booting the arch install cd and then pointing to the root= device. but, as you say, just d/l the arch install CD and try it out. Right now I have ubuntu installed on that drive and want to remove it to replace it with arch.

The problem I have is this, I got a new printer for x-mas as a gift and CAN NOT run it on linux. Damn shame really, lexmark corp sucks. Anyway, this is forcing me to install a copies of windows until lexmark printers are supported in linux. But, I am not gonna install windows to the larger HD, I'd rather have arch on that HD. This is where cloning my arch setup comes into to play. If everything goes right, even if It doesn't work, I should still have my arch install so I am not to worried about trying this.

I hope I have all my basis covered, I have read the link u posted a few times now and am confident in that procedure. Now to find my arch install CD. now that's a mystery... smile (can be anyone of 100 cd's floating around my room)

Offline

#15 2008-01-05 02:39:14

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

fwojciec: That worked out so brilliantly. There where a few catches here and there. I will list these below for anyone else that is reading. But, let me explain my setup a little bit before I do. I have it setup that IDE drive is first HD and SATA drive is the second HD by default, CD-rom is the first boot device before HD's, but when I wanna boot one or the other I change that in the bios effectively switching there order.

Now this caused a few problems...

1. in fstab and menu.lst I had to point the device to /dev/sda1 even though the arch install CD need to be pointed to root=/dev/sdb1

2. in the RIP rescue disk cd, IDE drive was detected as hda.

This made things very confusing when I was trying to archive the IDE drive and then extract it to the new SATA(sda1 drive) The directions say...

tar xvzf sda2/hda1.partition.tar.gz -C /mnt

which extracts it to /mnt/hda1 even though u have to mount the device 

mount /dev/sda1 [dir_u_made]

. which is deceiving because I am under the impression u do not have to mkdir hda1 since that's what the -C switch does, is create a directory named hda1 in /mnt. 

Its even hard to explain it here without actually being here to see my setup. Anyway, that was a sure fire tutorial, but not an easy one to follow, especially when u add in the way arch sees the IDE drives.

Thank your for your help. So now I have a functioning arch install on my new SATA drive with a backup in a gzipped archive located on sda2 and swap on sda3.

Offline

#16 2008-01-05 14:37:58

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: copy my arch install from one HD to another HD, as is...

The way I do it, I mount both partitions. for example sda3 and sdb3,  from a live cd to the /mnt directory.

Then If I want to copy everything from sda3 to sdb3 I just do...

cp -a -v /mnt/sda3/* /mnt/sdb3


-- archlinux 是一个极好的 linux

Offline

#17 2008-01-06 06:42:32

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

Leigh wrote:

The way I do it, I mount both partitions. for example sda3 and sdb3,  from a live cd to the /mnt directory.

Then If I want to copy everything from sda3 to sdb3 I just do...

cp -a -v /mnt/sda3/* /mnt/sdb3

I would suspect u would still need to install grub and issue the mkinitcpio command again?

I will add that there is an added benefit to the way I did it. I now have a snapshot of my current setup backed up on a separate partition. For me now, arch install is only 20 minutes away. It takes a little while to decompress 14 gig gzip file.

Offline

#18 2008-01-06 11:16:50

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: copy my arch install from one HD to another HD, as is...

If grub is on the partition your copying from, you wouldn't need to install / reinstall it.

I know there's a lot of ways to do it. Using cp is not the most practical way, but it's simple and effective. You could even cp -a everything from the system your booted into, to another disks partition, except for the /proc directory. of course afterwards, there would be a few files you would have to alter to reflect the new disk, like fstab and grubs menu.lst. Then, other than needing to create a empty /proc dir, it's a bootable system, the same as the host system. At least for me it was. : )


-- archlinux 是一个极好的 linux

Offline

#19 2008-01-07 21:56:32

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: copy my arch install from one HD to another HD, as is...

recently I just updated my backup disk. I don't need to keep a regular automated backup. I just use the back up system for emergencies, so every blue moon or so, when my system is really solid, I'll re-clone my main system to the backup disk. The partitions on my backup are set up to match my main disk. This is a simple script I wrote a while back using rm and cp to automate the clone. It holds back three files and replaces them, so when it's done, I can boot into the backup disk which is an exact clone of my main system. I have a seperat /boot partition, so the boot directory is empty on the / partition. I just use that directory to temporarily store anything I don't want to wipe out. So after manually mounting, I just run the script. I know this is probably an old fashioned way of doing it? It seems to work really well. Since I only do this every 3 or 4 months or so, (if that), I think it would be a lot cleaner to just reformat the partition each time, then do the clone.

#!/bin/bash

cp -a /mnt/sdb3/etc/fstab /mnt/sdb3/boot
cp -a /mnt/sdb3/etc/mtab /mnt/sdb3/boot
cp -a /mnt/sdb3/etc/rc.conf /mnt/sdb3/boot

rm -r -v /mnt/sdb3/bin
rm -r -v /mnt/sdb3/etc
rm -r -v /mnt/sdb3/home
rm -r -v /mnt/sdb3/lib
rm -r -v /mnt/sdb3/lib64
rm -r -v /mnt/sdb3/opt
rm -r -v /mnt/sdb3/root
rm -r -v /mnt/sdb3/sbin
rm -r -v /mnt/sdb3/srv
rm -r -v /mnt/sdb3/sys
rm -r -v /mnt/sdb3/usr
rm -r -v /mnt/sdb3/var

cp -a -v /mnt/sda3/* /mnt/sdb3
cp -a -v /mnt/sdb3/boot/fstab /mnt/sdb3/etc
cp -a -v /mnt/sdb3/boot/mtab /mnt/sdb3/etc
cp -a -v /mnt/sdb3/boot/rc.conf /mnt/sdb3/etc
rm /mnt/sdb3/boot/fstab
rm /mnt/sdb3/boot/mtab
rm /mnt/sdb3/boot/rc.conf

Last edited by Leigh (2008-01-07 23:57:25)


-- archlinux 是一个极好的 linux

Offline

#20 2008-01-08 06:46:44

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: copy my arch install from one HD to another HD, as is...

If grub is on the partition your copying from, you wouldn't need to install / reinstall it.

I do not understand this, I am not talking about /boot/grub. I am talking about grub on the MBR. I do not see how a cp is gonna copy over the MBR. Maybe some clarification on this is needed???

Offline

#21 2008-01-08 07:02:45

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: copy my arch install from one HD to another HD, as is...

Yes your right, I meant if grub was installed to the partition. For the mbr you'll just need to do >grub setup (hd0) or which ever disk your installing to. Anyway, the way I clone my disk probably isn't a good way if it's something you want to do on a regular basis. But for a one time thing, it's simple to do.


-- archlinux 是一个极好的 linux

Offline

Board footer

Powered by FluxBB