Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

It is possible to move an installed Linux from one drive to another or from one disk to another by two methods:

  1. dd command which copies sector by sector including boot sector
  2. cp command, and then installing/updating grub

These are very handy and easy methods, but I have no seen any instruction for using these methods for installing a new Linux on a new machine. Is there any disadvantage for this?

For example, we can boot from a Live CD, and copy the files of a minimal installed Linux (without grub); then installing grub through chroot. In other words, we can have a minimal linux on a USB drive, and install it on any machine (by boot from it, copy itself, chroot, etc).

The only things that should be altered (to my knowledge) is grub and fstab from on machine to another. Is there any disadvantage or drawback?

NOTE: I know that Live CD installers somehow do a similar task, but I am curious if simple copying can cause problem on a new machine?

share|improve this question
    
Live CDs and USB-drive distributions are very different beasts. A live CD is designed to run from read-only media and often uses tricks like file system overlays and such, which is not needed when running from read/write media such as a USB flash drive. The former has complexity which simply is not needed for an installed distribution. USB flash drive installations are much closer to a plain Linux distribution installation. –  Michael Kjörling Mar 8 '13 at 8:54
    
Right. Live CD/USB images that offer an "install to hard drive" mode generally run an actual installation process from their parent distros rather than doing a 1:1 copy of the active system. –  Shadur Mar 8 '13 at 9:02
1  
For variations, see other questions tagged cloning. –  Gilles Mar 8 '13 at 21:51
add comment

marked as duplicate by Gilles, jasonwryan, Renan, warl0ck, manatwork Mar 9 '13 at 15:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Yes,

Mount the two disks to i.e /old and /new, and issue a rsync between them, (AS ROOT)

rsync -av --delete /old /new

Afterwards chroot into /new and restore grub configuration. (and fstab)

share|improve this answer
    
Thanks for your supportive reply. I want to know if there is a possible for copying an installed linux to another machine (with different specification). Or is it safe to copy a working linux between different machines (not disks). –  All Mar 8 '13 at 3:29
    
@All I don't get it, over network? If it's local, I already gave you a workable way –  warl0ck Mar 8 '13 at 3:32
    
@All it's all safe, I've done this multiple time, just remember to fix the fstab and other stuff you might think of –  warl0ck Mar 8 '13 at 3:33
    
@warl0ck It's still safe even if it's not local; rsync can do its magic over a network just as easily, after all. –  Shadur Mar 8 '13 at 8:59
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.