LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2010, 12:01 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Rep: Reputation: 69
A question about migrating your entire OS...


Let's say I have my Linux setup all nice and perfect. All the right packages, all the right kernel patches and modules, etc. Let's say I wanted to create a snapshot of how my whole OS was at the time in case I want to restore or maybe migrate this to another computer. What would I have to do. I want to store this on an external HD.

Here's my understanding so far. I want to make sure I'm not missing anything.

1. (This step really isn't necessary because the Step 2 would include the vmlinuz file, however I seek understanding) Copy my kernel /boot/vmlinuz-huge-smp-2.6.29.6-smp to my external HD. Would I need the /boot/config-huge-smp-2.6.29.6-smp and the /boot/System.map-huge-smp-2.6.29.6-smp. What are these for exactly? Does the config one just have all my kernel parameters in case I want to recompile the kernel later? Or does the bootloader use the config file to start the kernel image with those config options? What about the system.map. Is it just a table of my partitions so the bootloader knows which partition is the master or boot partition? In my lilo.conf there's only an entry for vmlinuz not the other two. How and where are these two files used? Are these necessary?

2. Run this
Code:
tar -cvzf -X /mnt /proc /sys /tmp complete-backup.tgz /
I would save the big complete-backup.tgz file to my external HD. That would be it?

Then if I wanted to install to another computer or a fresh machine I'd do once logged in as root.

1. Run this
Code:
tar -xvf complete-backup.tgz /
2. Run this
Code:
mkdir /{mnt,proc,sys,tmp}
mount --bind /dev/ /dev
mount -t proc proc /proc
Do I need to do anything special to the sys and tmp root folders?

Would that work?

Would this be considering making a ghost image? Is there a more efficient or a quicker solution?
 
Old 07-11-2010, 12:08 PM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
The best way would be to have a image copy of the partition. Of course ... keep /home on a separate partition
 
Old 07-11-2010, 12:10 PM   #3
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
IMHO the easiest version: use
Code:
tar -c -j --one-file-system --preserve-permissions -f /path/to/backup.tar.bz2 /
if you have separate partitions/volumes for /usr or /home etc, do the same for them.
 
Old 07-11-2010, 12:14 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,921

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by trist007 View Post
Let's say I have my Linux setup all nice and perfect. All the right packages, all the right kernel patches and modules, etc. Let's say I wanted to create a snapshot of how my whole OS was at the time in case I want to restore or maybe migrate this to another computer. What would I have to do. I want to store this on an external HD.

Here's my understanding so far. I want to make sure I'm not missing anything.

1. (This step really isn't necessary because the Step 2 would include the vmlinuz file, however I seek understanding) Copy my kernel /boot/vmlinuz-huge-smp-2.6.29.6-smp to my external HD. Would I need the /boot/config-huge-smp-2.6.29.6-smp and the /boot/System.map-huge-smp-2.6.29.6-smp. What are these for exactly? Does the config one just have all my kernel parameters in case I want to recompile the kernel later? Or does the bootloader use the config file to start the kernel image with those config options? What about the system.map. Is it just a table of my partitions so the bootloader knows which partition is the master or boot partition? In my lilo.conf there's only an entry for vmlinuz not the other two. How and where are these two files used? Are these necessary?

2. Run this
Code:
tar -cvzf -X /mnt /proc /sys /tmp complete-backup.tgz /
I would save the big complete-backup.tgz file to my external HD. That would be it?

Then if I wanted to install to another computer or a fresh machine I'd do once logged in as root.

1. Run this
Code:
tar -xvf complete-backup.tgz /
2. Run this
Code:
mkdir /{mnt,proc,sys,tmp}
mount --bind /dev/ /dev
mount -t proc proc /proc
Do I need to do anything special to the sys and tmp root folders?

Would that work?

Would this be considering making a ghost image? Is there a more efficient or a quicker solution?
First, it wouldn't work. Look at how you'd do the restore:
Code:
tar -xvf complete-backup.tgz /
and think about it. You'll overwrite a LOT of the system libraries....like the ones that tar is using, libc, etc. Once they get partially overwritten, the process(es) using them will die...leaving you with NO WAY to continue.

This has been covered on here many times. Mondoarchive, mkcdrec, and systemimager are three pieces of software, designed specifically to do this. Leave you with bootable, 'snapshots' of an entire system, ready to be put onto other 'blank' systems. Mondoarchive is especially flexible, letting you boot from CD, DVD, or over net from an ISO image. Store it wherever you want.
 
Old 07-11-2010, 12:19 PM   #5
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
Yes TB0ne you're right, didn't think about that. I'd have to boot up a Live CD and copy the contents to say /mnt/sda3 instead of /.
I found this on ghosting a drive
http://www.linuxweblog.com/blogs/san...drive-using-dd

However on the last statement about zero'ing out unused blocks. That last dd command stated, won't that erase everything in the partition? Or just the unused blocks? What kind of output file(of) would I use if I had a partition /dev/sda3?

Last edited by trist007; 07-11-2010 at 12:21 PM.
 
Old 07-11-2010, 01:32 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
The command you are referring to is this one, I think:

Code:
# dd if=/dev/zero of=/tmp/delete.me bs=8M; rm delete.me
That will create a big file called delete.me The dd command will eventually fail because the disk has run out of space because all the free space has been allocated to the file delete.me, which is fill of zeros.

The second part of that command then removes the file delete.me which frees up space on the filesystem, but leaves the now unused parts of your disk filled with zeros, which are easily compressible.

[Pointless aside, 5% of your disk space may still be full of random junk, because of the space reserved for root, but it's a start]
 
Old 07-11-2010, 02:04 PM   #7
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
Oh wow yes I see now. That's smart I like that, thanks
 
Old 07-11-2010, 06:20 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Everything (the backup and the restore) needs to be done from a liveCD. But it works fine. Personally I don't bother with tar, but that just personal preference - I just "cp -a ..."
Make sure you have partitions and filesystems in place on the target.

There is also the small matter of a bootloader.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find a file on entire drive question R4ndom Linux - Newbie 3 04-20-2009 09:01 PM
Migrating from Slack to Ubuntu / Fluxbox xorg.conf question wakeboarder3780 Ubuntu 1 02-12-2007 01:34 PM
Encrypting an entire CD binarybob0001 Linux - General 0 03-26-2006 05:30 PM
Migrating to OO.o AnanthaP General 1 01-10-2006 09:47 AM
entire neighborhood slack66 Linux - Newbie 7 04-11-2004 10:23 AM


All times are GMT -5. The time now is 10:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration