PDA

View Full Version : How do you migrate a Fedora Core 5 LVM installation to a new hard drive?



LinuxHat
4th May 2006, 08:05 PM
I have a Fedora Core 5 installation that uses Logical Volume Management and I would like to transfer this system to a new hard drive. I have a USB connected drive and I would hope to be able to move the new system on to the new, larger hard drive there. From there, I would move it into the original machine swapping it with the one there.

How do you set up the new drive on the USB and how do you transfer the old installation on to the new drive? There is a graphical tool, system-config-lvm, that looks like it might be useful. Does anyone know how to apply it to this end? I have examined a thread here on the subject* and there is a lot missing in it for my installation. My LVM installation does not use the usual "Linux" system partition ID for the main partition. When you examine it using fdisk, it says "Linux LVM", and I can't find any documentation explaining how this effects writing a file system. Also, I do not see just one partition to copy, I see two. One is the boot partition.

Any documentation, tips or clues would be appreciated.

*partion copy (http://fedoraforum.org/forum/showthread.php?t=41402)

Jeff Sadowski
4th May 2006, 10:41 PM
I was going to do the same thing and I too am a little stumped as the best way to go about this.
I am thinking about using zsplit (supposidly partimage's replacement) to trasfer the image and back it up at the same time. Or maybe using partimage to take off my one ext2 partition off of my lvm and build a new lvm and put it on there.

brunson
4th May 2006, 10:45 PM
1) Connect the USB drive
2) Use system-config-lvm to create a new logical volume
3) Create filesystems
4) mount the filesystems
5) copy files between filesystems
6) install grub on new disk
7) swap drives
8) Profit!!!

brunson
4th May 2006, 10:53 PM
With that said, LVM will aggregate multiple partitions on multiple disks into a single metadevice or Volume Group (vg). This vg can then be allocated into logical volumes which will hold your filesystems.

Good Reading:
http://www.tldp.org/HOWTO/LVM-HOWTO/index.html
http://sourceware.org/lvm2/
http://www.gentoo.org/doc/en/lvm2.xml

Theres another good into on the IBM developers site, but I didn't find that in my first Google search, so you can look for it on your own. Read those and come back with more specific questions.

LinuxHat
4th May 2006, 11:11 PM
1) Connect the USB drive
2) Use system-config-lvm to create a new logical volume
3) Create filesystems
4) mount the filesystems
5) copy files between filesystems
6) install grub on new disk
7) swap drives
8) Profit!!!


Thanks, but I need much more detail than this. The LDP LVM How To is of no use. I need something like a comprehensive recipe. I don't need to use USB, if it makes it easier to explain, let's assume that the drive is installed with IDE.

LinuxHat
4th May 2006, 11:18 PM
I should say that I used the "dd" command following some instructions provided here:

http://www.rajeevnet.com/hacks_hints/os_clone/os_cloning.html

And it booted up just like the original with LVM intact and everything. But, what it looks like I got was the originally sized partitions on the newer, larger hard drive. I don't want a clone, I want a new partition with larger space than the original main partiton. I don't think dd will do that for me.

peters
4th May 2006, 11:20 PM
One of the easiest ways to accomplish this is to use dd to copy, block-by-block, the entire contents of one drive onto the other. Then, after you've swapped out the disks, you can go in and expand your LVM to the entire disk.

You should be able to do the following (this is what I do)


[root@fedora ~] # dd if=/dev/hda of=/dev/sda bs=32768k

This assumes that your system's physically mounted disk is IDE and known as hda. USB disks usually come in as SCSI, so that would most likely be sda. Remember, IF == Input and OF = Output. As long as you have those straight, you will not lose data.

Oh, and to expand LVM is a bit easier. You can dig on the web and find HOWTOs, simply run the LVM command line interface (just type "lvm") and look at its help (enter "help"), or even install & use [[EVMS][http://evms.sf.net]]. Shrinking LVM is a lot harder :)

Peter

edit: LOL, I am too slow. Please refer to above post :)

LinuxHat
4th May 2006, 11:37 PM
Yes, it occured to me that there might be a way to use the rest of the hard drive once the drive is installed. It is not at all apparent how you might go about that. The rest of the drive does not show up as uninitiated in my graphical Logical Volume Manager. I can't use fdisk, because that will wipe out the whole installation with a new table.

But that seems like a good lead.

LinuxHat
5th May 2006, 01:08 AM
I've spent a little time at the LVM command line and it still is not clear how to proceed.

Here is what I've done:

I start with my Fedora 5 Core installation on a little 8 GB drive on /dev/hda

I install my larger 40 GB so that it is available as /dev/hdc

Using fdisk I give /dev/hdc two new partitions to match the installation on /dev/hda as provided Fedora's installer; /dev/hdc1 with the boot sector toggled on and a Linux 83 system partition type and /dev/hdc2 with the rest of the drive set to Linux LVM 8e partition type.

I apply the instructions I found at the above link I posted:

dd if=/dev/hda of=/dev/hdc bs=446 count=1
dd if=/dev/hda1 of=/dev/hdc1
dd if=/dev/hda2 of=/dev/hdc2

I shutdown and remove the original drive so that the new 40 GB drive is the only one found by BIOS and boot.

Great! That worked. I'm back again in the new drive, but I look around at all the graphical interfaces explaining my paritions and all I see is the original space that the old installation has. I look at the Logical Volume Manager and see that my main /dev/VolGroup00/LogVol00 is only 7.22 GB. Poking around Logical Volume Manager provides no clues as to where the rest of my hard drive is and how I can get at it.

So, I figure out that the way to access LVM from the command line is "lvm". "vdiskscan" gives me a list showing /dev/hdc2 as being 37.16 GB with "LVM Physical Volume" labeled after it. "lvextend" looks like it might be promising in getting me the rest of my disk, but I keep getting "insufficient ... extents ... allocated" or something.

So what is going on? How do I proceed to get the rest of my physical disk? Even better would be some way of just copying one disk to the other directly using lvm. It's hard to believe that no such solution is available and documented.

Any and all tips or clues would be appreciated.

Jeff Sadowski
5th May 2006, 04:13 AM
The advantage zplit has is that in the process of moving I will be creating dvd iso's of the files and backing up at the same time.

LinuxHat
6th May 2006, 05:25 AM
Problem solved, but not at this forum. See the post at Linux Questions forum:

http://www.linuxquestions.org/questions/showthread.php?p=2233101&posted=1#post2233101

Jeff Sadowski
6th May 2006, 06:22 AM
I see the same responces here is there one I am missing? I even give two other methods than anything I see there.

LinuxHat
6th May 2006, 04:47 PM
Look at the post titled "Success!"

rhb100
8th July 2006, 12:50 AM
How do I activate or get to files in inactive logical volumes? The results of lvscan and fdisk -l are shown below. The active logical volumes are on /hdb my FC5 boot disk. The inactive logical volumes are on an external 9 GB hard drive /dev/sda. The inactive logical volumes were created in a previous FC5 installation before I decided to install FC5 on a 60 GB hard drive.
329[root@localhost ~]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [56.12 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
inactive '/dev/volgp9gb/logvo9gb' [7.47 GB] inherit
inactive '/dev/volgp9gb/logvo1gb' [1.00 GB] inherit
330[root@localhost ~]#

330[root@localhost ~]# fdisk -l
Disk /dev/hda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 30401 244196001 7 HPFS/NTFS
Disk /dev/hdb: 61.4 GB, 61492838400 bytes
64 heads, 32 sectors/track, 58644 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 100 102384 83 Linux
/dev/hdb2 101 58644 59949056 8e Linux LVM
Disk /dev/sda: 9237 MB, 9237086208 bytes
255 heads, 63 sectors/track, 1123 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1123 8916075 8e Linux LVM
331[root@localhost ~]#

rhb100
8th July 2006, 01:03 AM
One possible solution is by using dump to backup your files and then use restore with the -r option. See man restore
and then scroll down to the -r option to see the other things you have to do.



I have a Fedora Core 5 installation that uses Logical Volume Management and I would like to transfer this system to a new hard drive. I have a USB connected drive and I would hope to be able to move the new system on to the new, larger hard drive there. From there, I would move it into the original machine swapping it with the one there.

How do you set up the new drive on the USB and how do you transfer the old installation on to the new drive? There is a graphical tool, system-config-lvm, that looks like it might be useful. Does anyone know how to apply it to this end? I have examined a thread here on the subject* and there is a lot missing in it for my installation. My LVM installation does not use the usual "Linux" system partition ID for the main partition. When you examine it using fdisk, it says "Linux LVM", and I can't find any documentation explaining how this effects writing a file system. Also, I do not see just one partition to copy, I see two. One is the boot partition.

Any documentation, tips or clues would be appreciated.

*partion copy (http://fedoraforum.org/forum/showthread.php?t=41402)

lovswr
22nd January 2007, 01:29 AM
LinuxHat, that lik you posted was really helpful.

I have two Western digital 80GB drives & two DVD-RW's, but I only have IDE controllers 0 & 1. Furthermore my hda drvie is Win98SE & my hdb is the FC5 installation.

I got a new 300GB Maxtor that I wanted to use in place of the 80GB Western Digital. So I used the 'dd' command to copy hdb1 & hdb2 (this is my original FC5 location) to hdc1 & hdc2, respectively. Then with the unused space on the Maxtor I created hdc2. I powered down, plugged the Maxtor in as slave on controller 0 to make it become hdb & rebooted. It took forever to copy that 71GB partition from my old hdb2 to the "new" hdc2.

After I rebooted, I used LVM (again as you documented) & just initialized all that unused space that was now hdb3 & added to my existing logical volume. I went from 79% full with the old 80GB Western Digital to about 24% full with the new 300GB Maxtor!


It took me a litte while to figure this out, but now I see that this is much better than the normal process with Windows.