Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


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

Rep: Reputation: 15
Making a drive image


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, 07:15 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990

Rep: Reputation: 68
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
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
cat /dev/device | bzip2 > image.bz2
You can then restore that image onto another partition of the same size using
bzcat image.bz2 > /dev/device
You can also copy files using
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
mkswapfs /dev/device
Old 01-05-2005, 07:23 AM   #3
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.
Old 01-05-2005, 10:20 PM   #4
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 10:22 PM.


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 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 08:13 AM
Making a partition image PhuckFonix Linux - General 6 06-27-2004 02:06 PM
Making ISO Image from Ghost. rridler Linux - Newbie 7 05-03-2004 08:04 PM
Making an iso image?? Peppercorn Linux - General 9 09-29-2003 09:23 AM
making an image of my drive antken Linux - General 1 07-16-2003 02:20 PM

All times are GMT -5. The time now is 09:30 PM.

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