LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 08-22-2006, 12:01 PM   #1
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Rep: Reputation: 0
LVM migration to regular volume


when I originally installed FC3 on my webserver / mailserver at home I used LVM to join two 20GB hard drives into one 40gb logical volume.

I now have an extra 80gb drive that I would like to install into that box to replace the 40GB logical volume.

Any ideas on what would be the best way to move away from the logical volumes to one regular volume, without totally redoing the entire setup?

Here are some commands from my machine:

# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID sI0iHC-irla-CdaF-iWh9-VQxC-U1sM-pRwoKt
LV Write Access read/write
LV Status available
# open 1
LV Size 37.34 GB
Current LE 1195
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID xxAJSm-BaQ0-spnd-QeTG-sN4K-Tov7-ECh0BZ
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 37.91 GB
PE Size 32.00 MB
Total PE 1213
Alloc PE / Size 1211 / 37.84 GB
Free PE / Size 2 / 64.00 MB
VG UUID 02Fevp-4SHU-Z9UO-X045-YOqa-4nZF-o5r47A

# pvdisplay
--- Physical volume ---
PV Name /dev/hda2
VG Name VolGroup00
PV Size 18.91 GB / not usable 0
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 605
Free PE 0
Allocated PE 605
PV UUID rWIbJh-UXPW-s5zy-xRSF-s3eG-BhGi-uS14mr

--- Physical volume ---
PV Name /dev/hdb1
VG Name VolGroup00
PV Size 19.00 GB / not usable 0
Allocatable yes
PE Size (KByte) 32768
Total PE 608
Free PE 2
Allocated PE 606
PV UUID zhYtFd-7ERI-DaUI-Xsp5-NWOt-UgZX-zEoaOS
 
Old 08-22-2006, 12:44 PM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
There are two things you can do:

Compress and tar all your data and configuration files to an external USB drive. Install the new OS under the new drive then restore.

Or, install the new drive, create the VG and LVs, mount them, copy the root partition to one LV, setup the new MBR and grub menu on the new drive. Unplugg the older drives, plug new drive and test.
 
Old 08-22-2006, 12:53 PM   #3
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
I just cleaned up some data, so now my usage is less than one 20gb disk.

Is there anyway that I can REMOVE lvm from this machine, which would result in all the data being on one of the 20gb drives? Then I would like to just use a tool like ghost to ghost that drive over to the 80gb drive and then I wouldn't have to mess with grub?
 
Old 08-22-2006, 01:39 PM   #4
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
You don't need ghost; you can do it with dd. However, you will still need to expand the partition with parted. The fastest and safest way would be to mount both drives and then copy the data over to the new drive, initialize grub on the new drive then restart with the new drive. This is especially useful for a quick and dirty upgrade to a production server.
 
Old 08-22-2006, 02:08 PM   #5
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ramram29
You don't need ghost; you can do it with dd. However, you will still need to expand the partition with parted. The fastest and safest way would be to mount both drives and then copy the data over to the new drive, initialize grub on the new drive then restart with the new drive. This is especially useful for a quick and dirty upgrade to a production server.
Ok, this is what I'll do tonight, any tips or links on the proper way to get grub setup on the new drive?

THANKS!
 
Old 08-22-2006, 02:21 PM   #6
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
After you copy the data run 'grub', then inside the grub prompt type:

grub> root (hd1,0)
grub> setup (hd1)

(hd1,0) = means second disk, first partition = where /boot is located.
 
Old 08-22-2006, 03:53 PM   #7
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
just to be thorough, here is my filesystem layout (its simple)

#df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 38542824 15630860 20954076 43% /
/dev/hda1 101086 39254 56613 41% /boot
none 257452 0 257452 0% /dev/shm

So, using dd and assuming that the new HDD is hdc with the boot partition on hdc1 and the filesystem on hdc2

would I use dd like this:

# Copies the data
dd if=/dev/mapper/VolGroup00-LogVol00 of=/dev/hdc2

# Copies the boot partition
dd if=/dev/hda1 of=/dev/hdc1

then I would need to do grub like you said:

grub> root (hdc1,0)
grub> setup (hdc1)

Last edited by Delta-9; 08-22-2006 at 03:54 PM.
 
Old 08-22-2006, 03:58 PM   #8
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
No, you need to boot with a rescue CD first. At the boot: prompt of the install CD type 'linux rescue'. It will drop you to a prompt. Run 'fdisk l' to detect both drives. Run:

dd if=/dev/hda of=/dev/hdc

and wait about one or more hours. dd takes very long. hence, if you're in a hurry then use ghost.

After run 'grub' then:

grub> root (hd1,0)
grub> setup (hd1)

Turn PC off, swap drives and test. Turn off again and use a rescue disk that has parted such as Knoppix or Sysresccd to expand the partition on the bigger new drive.
 
Old 08-22-2006, 04:00 PM   #9
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
I forgot, after you use parted then you will need to extend the LVM that is overlaying the disk partition with command 'lvextend'.
 
Old 08-22-2006, 06:32 PM   #10
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
This is what I have done so far.

I booted via Knoppix b/c I didn't have a rescue CD that worked correctly. I opened up a terminal window and did an 'su' and then did fdisk -l.

I could see all 3 HDDs.

So I started with 'dd if=/dev/hda of=/dev/hdd'

I thought this might be wrong and did a ctrl-c after about a minute, and did fdisk -l again, I saw that now hda and hdd had an identical layout, so I restarted with the same dd command as above.

Once this is done, from your instructions you say to do grub, next:

grub> root (hd1,0)
grub> setup (hd1)


I was thinking that I might be able to just install hdd into the IDE chain where hda *was* and leave hdb in place. (skipping the grub step above)

How do I go about getting any data that *might* be on hdb onto the new 80gb drive?
 
Old 08-23-2006, 07:38 AM   #11
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Mount /dev/hdb1 to a temporary folder like /mnt/hdb1 then copy whatever you need from /mnt/hdb1. If hdb1 has an LV then you'll first need to run 'vgchange -a', I think, in order to activate the LV.
 
Old 08-23-2006, 08:29 AM   #12
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
This is where I am at now...

I have rebooted with the 80gb drive in place of the old disk which had /boot on it.
It now has hda1, hda2, hda3, and hda4. hda1 and hda2 were the old partitions which were copied over via dd. I created hda3 and hda4 and added them to the VolGroup. This is what the vgdisplay shows now:

#vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 4
Act PV 4
VG Size 95.19 GB
PE Size 32.00 MB
Total PE 3046
Alloc PE / Size 1936 / 60.50 GB
Free PE / Size 1110 / 34.69 GB
VG UUID 02Fevp-4SHU-Z9UO-X045-YOqa-4nZF-o5r47A

and the Physical Volumes:

#pvdisplay
--- Physical volume ---
PV Name /dev/hda2
VG Name VolGroup00
PV Size 18.91 GB / not usable 0
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 605
Free PE 0
Allocated PE 605
PV UUID rWIbJh-UXPW-s5zy-xRSF-s3eG-BhGi-uS14mr

--- Physical volume ---
PV Name /dev/hdb1
VG Name VolGroup00
PV Size 19.00 GB / not usable 0
Allocatable yes
PE Size (KByte) 32768
Total PE 608
Free PE 608
Allocated PE 0
PV UUID zhYtFd-7ERI-DaUI-Xsp5-NWOt-UgZX-zEoaOS

--- Physical volume ---
PV Name /dev/hda3
VG Name VolGroup00
PV Size 28.47 GB / not usable 0
Allocatable yes
PE Size (KByte) 32768
Total PE 911
Free PE 170
Allocated PE 741
PV UUID b0HE2V-nHvU-7dmP-sSyB-fvuN-ujfd-sVrxeQ

--- Physical volume ---
PV Name /dev/hda4
VG Name VolGroup00
PV Size 28.81 GB / not usable 0
Allocatable yes
PE Size (KByte) 32768
Total PE 922
Free PE 332
Allocated PE 590
PV UUID GyvDXf-M8F6-2j1u-kn6y-cdVH-96pr-FQQ4QB

and Logical Volumes:

# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID sI0iHC-irla-CdaF-iWh9-VQxC-U1sM-pRwoKt
LV Write Access read/write
LV Status available
# open 1
LV Size 60.00 GB
Current LE 1920
Segments 4
Allocation inherit
Read ahead sectors 0
Block device 253:1


If you notice the Logical volmes are only 60GB while the volume group shows 95GB. I thought I needed to do something like this for pvmove to work.

I then tried to do 'pvmove /dev/hdb' which then tried to remove hdb but that failed.

Am I getting any closer to being able to remove that HDB disk?
 
Old 08-23-2006, 08:43 AM   #13
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
ahh sweet... I think I got it:

#vgreduce VolGroup00 /dev/hdb1
Removed "/dev/hdb1" from volume group "VolGroup00"

But now my next question is: how do I get 'df -k' to show the actual size of my new VolGroup?

# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 38542824 15630668 20954268 43% /
/dev/hda1 101086 39254 56613 41% /boot
none 257452 0 257452 0% /dev/shm

its still only showing ~40gb

Last edited by Delta-9; 08-23-2006 at 08:45 AM.
 
Old 08-23-2006, 08:45 AM   #14
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
I remember having a similar problem. I think after you add an a partition to an LV then you need to extend the LV to occupy the empty space in the underlying partition. You need to unmount the LV then run something like 'lvextend -L 20GB /dev/VolGroup00/LogVol00'. That will make it extend. However, do this only after unmounting. Do it with a linux rescue session or with a Knoppix disk if necessary after running 'vgchange -a'.
 
Old 08-23-2006, 09:08 AM   #15
Delta-9
LQ Newbie
 
Registered: Aug 2006
Distribution: FC3
Posts: 11

Original Poster
Rep: Reputation: 0
I think this is what I need to do, just found this online.

Gonna try this later tonight once I am back home on console:

# umount /dev/myvg/homevol/dev/myvg/homevol
# resize2fs /dev/myvg/homevol
# mount /dev/myvg/homevol /home

Sound about right?
 
  


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
How do I resize LVM volume group? rconan Fedora 5 04-22-2009 07:45 PM
LVM -creating physical volume satimis Linux - General 2 08-10-2006 01:44 AM
shutting down LVM volume groups aztek Debian 2 06-02-2006 09:58 PM
How to mount LVM Volume twice Phil.Johnson Linux - Software 0 03-14-2006 11:17 AM
LVM Physical Volume Lucky_Sevin Linux - Software 2 01-10-2006 10:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 12:32 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
Open Source Consulting | Domain Registration