disk replacement

Paul Howarth paul at city-fan.org
Wed May 4 13:24:29 UTC 2005


Oliver Vecernik wrote:
> Hi Paul,
> 
> Paul Howarth schrieb:
> 
>>>My thoughts were first to remove /dev/hdb, create two partitions, moving
>>>/boot and VG to it, power down, remove old disk, jumper new one as
>>>master and finally power up.
> 
> 
> How do I copy the MBR?

You could do it using dd, or you could just use grub-install to put grub 
on hdb.

>>>Can anybody give me some advice?
>>
>>Sounds like a reasonable plan. Please post the output of:
>>
>># vgdisplay -v
> 
> 
> # vgdisplay -v
>     Finding all volume groups
>     Finding volume group "VolGroup00"
>   --- 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               75,47 GB
>   PE Size               32,00 MB
>   Total PE              2415
>   Alloc PE / Size       2413 / 75,41 GB
>   Free  PE / Size       2 / 64,00 MB
>   VG UUID               Scg1fw-WM5q-eoj5-rcf8-AAAi-sKmV-nrWAYK
> 
>   --- Logical volume ---
>   LV Name                /dev/VolGroup00/LogVol00
>   VG Name                VolGroup00
>   LV UUID                c3JfzP-cN3w-v49v-nXYN-whIc-b5A2-f7KMzx
>   LV Write Access        read/write
>   LV Status              available
>   # open                 1
>   LV Size                74,41 GB
>   Current LE             2381
>   Segments               2
>   Allocation             inherit
>   Read ahead sectors     0
>   Block device           253:0
> 
>   --- Logical volume ---
>   LV Name                /dev/VolGroup00/LogVol01
>   VG Name                VolGroup00
>   LV UUID                K6Tqyu-jO0S-BpPC-8ob7-t7Qd-SOQ1-aK6EUY
>   LV Write Access        read/write
>   LV Status              available
>   # open                 1
>   LV Size                1,00 GB
>   Current LE             32
>   Segments               1
>   Allocation             inherit
>   Read ahead sectors     0
>   Block device           253:1
> 
>   --- Physical volumes ---
>   PV Name               /dev/hda2
>   PV UUID               EpsJjV-7Svg-cMVX-sjdF-lMXQ-ruCB-9bzrXP
>   PV Status             allocatable
>   Total PE / Free PE    1189 / 0
> 
>   PV Name               /dev/hdb1
>   PV UUID               0bUeIv-uudT-MadJ-WDpU-yMD0-4P4n-Suitsd
>   PV Status             allocatable
>   Total PE / Free PE    1226 / 2

This is going to be a bit painful unfortunately, since you're using most 
of the space in the volume group.

/dev/VolGroup00/LogVol01 is, I guess, set up for swap?

To free up space, you'll need to reduce the size of 
/dev/VolGroup00/LogVol00 so that both it and /dev/VolGroup00/LogVol01 
can fit on hda2. Let's say that's 30G.

The first step is to resize the / partition. You'll need to boot from 
the rescue CD to do that so that / won't be mounted. Once booted, use 
resize2fs to shrink /dev/VolGroup00/LogVol00 to 30G (this will take a 
while). You can then use lvreduce to shrink the size of 
/dev/VolGroup00/LogVol00; use a size larger than 30G (e.g. 32G) so that 
you can be sure that the filesystem isn't truncated.

You can then boot back into Fedora, in which "df" should show the 
reduced size of the partition. You can then use pvmove to move 
everything off /dev/hdb1 onto /dev/hda2, and then vgreduce to remove 
/dev/hdb1 from the volume group. At that point you can then repartition 
hdb, add a new LVM physical volume into your volume group (vgextend), 
use pvmove to move all the data to hdb, and vgreduce to remove hda2 from 
the volume group. You can also use ext2online to bring the 
/dev/VolGroup00/LogVol00 filesystem up to the full size of the volume 
it's on so that no space is wasted.

Of course you still need to move /boot and install grub on hdb.

Paul.





More information about the fedora-list mailing list