LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-05-2005, 05:30 AM   #1
pcdude
LQ Newbie
 
Registered: Sep 2004
Location: South Africa
Distribution: Mandrake
Posts: 26

Rep: Reputation: 15
Making a drive image


Hi

At our company we have a mandrake system (9.1) which originally only had a 40 GB hardrive. Later we bough a another 80GB drive.

Problem is that the 40GB with the / and home partitions is now getting rather full. The 80BG drive contains mostly backups. What I would like to do is to swap the contents of the drives around. That is putting the / and home directorties on the 80GB and put backups on the 40GB.
So I guess I'll need to make an image of the drive and place that image on the 80GB drive.

First of all, I would like to know if this is possible and safe?
Second, what tools can be used to do this?

Thanks in advance
 
Old 01-05-2005, 06:15 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
This is possible and (at least theoretically) safe.

You will need to look closely at the partitions of both drives. This is something that must be done on a partition-by-partition basis, not a drive-by-drive basis.

First of all, create a rescue disk and make sure that you can boot into it.

Next, I would recommend finding out how to reinstall your bootloader; this is something that you will need to do after moving partitions around so it's probably easiest to do it first. For lilo this is as simple as typing
Code:
/sbin/lilo
Now boot off the rescue disk; you can't create a reliable image of a partition if it's already mounted, and you get various problems if things like the active /sbin/ directory suddenly moves. So you don't want to do this on a live system.

Take a backup of your system, in case you delete something you shouldn't.

gnuparted would be a useful program here, as it lets you resize and copy partitions without deleting their contents. Use this rather than fdisk.

To create an image of a partition, you can use
Code:
cat /dev/device | bzip2 > image.bz2
You can then restore that image onto another partition of the same size using
Code:
bzcat image.bz2 > /dev/device
You can also copy files using
Code:
cp -dprx /path-from /path-to
Linux doesn't have any special immovable files like Windows does, so this will always work. It's a good way to copy a partition's contents to a bigger or smaller directory. The x flag means to stay on one partition.

After changing the partitions around, you will need to update the /etc/fstab file to point to the new locations of each mount-point.

I would advice making a written plan of how you want to do this before you start in case you end up overwriting something you shouldn't.

You will probably have at least one swap partition; this can be safely deleted. You can create a new swap partition using
Code:
mkswapfs /dev/device
 
Old 01-05-2005, 06:23 AM   #3
pcdude
LQ Newbie
 
Registered: Sep 2004
Location: South Africa
Distribution: Mandrake
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for your reply.

It seems that this is much easier than it would be on a windows box ;-)

I'll try it soon.
Cheers
 
Old 01-05-2005, 09:20 PM   #4
Travers
Member
 
Registered: Jul 2004
Location: Des Moines
Distribution: Gentoo
Posts: 111

Rep: Reputation: 15
Hm, I would wipe the 80 Gig, make a e3fs, copy everything over using rsync, write a new fstab and bootloader config, install the boot loader, and physically swap the drives, just incase something is pointing to /dev/hda when it is on /dev/hdb. This way you don't have to mess with any of the partions, which is really scary. Atleast you're not wiping the 40 gig so if you fsck up, you will be ok. =)

Last edited by Travers; 01-05-2005 at 09:22 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Making image of harddrive crxgames SUSE / openSUSE 2 04-11-2005 07:13 AM
Making a partition image PhuckFonix Linux - General 6 06-27-2004 01:06 PM
Making ISO Image from Ghost. rridler Linux - Newbie 7 05-03-2004 07:04 PM
Making an iso image?? Peppercorn Linux - General 9 09-29-2003 08:23 AM
making an image of my drive antken Linux - General 1 07-16-2003 01:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:37 PM.

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
Open Source Consulting | Domain Registration