[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Managing the physical re-arrangement of my disks (boot sector question and lvm question)



I have a debian sarge server with 3 ide drives.  Apart from the root 
filesystem on its own ext3 partition (hda1), the remainder of these disks use 
lvm partitions.  I use grub to manage the boot process.

I am about to try and upgrade with some new SATA disks, but from a case/power 
consumption point of view I cannot keep all the existing ide drives.

Instead, what is currently /dev/hdc (a 200GB disk) with a single LVM 
partition, needs to be ultimately become /dev/hda with two partitions, a 4GB 
root file system on /dev/hda1 and an LVM volume on /dev/hda2, and the two 
existing drives in /dev/hda and /dev/hdb will be removed. [I do have a usb 
external enclosure, into which I could move some of these ide drives to 
restore data after the move if I cannot achieve it in-situ.]

So I am now planning the move (assuming I can stop to server running for a 
short while).

I can just about use pvmove to clear off /dev/hdc, so that I can then 
repartition it.  Temporarily I intend to partition it with three partitions. 
The first will be the new root file system, the second and third will be lvm 
partiions big enough to hold each of the two volume groups from the 
current /dev/hda and /dev/hdb devices.  

I have three questions.

1)
Before finally removing it, I would like to set up the disk that is currently 
in /dev/hdc with a boot sector and filesystem, such that when re-install it 
as /dev/hda it just boots up the root filesystem in its first partition.  
Obviously I can just copy the existing filesystem over, and adjust a few 
mount points, but what about the boot sector.  Can I just use dd to copy the 
first 512 bytes from /dev/hda to /dev/hdc, or will that screw up my partition 
tables?  In otherwords, how to I prepare the boot sector on /dev/hdc, so when 
I install it as /dev/hda it just works?

2) Before finally removing /dev/hdc, I intent to pvmove all the lvm data from 
the other two drives to it.  When I finally move this to /dev/hda, will the 
lvm startup find the volumes ok in their new place, or will I have to prepare 
somehow (vgexport and vgimport come to mind)?

3) One I have moved the old /dev/hdc to /dev/hda, and the dispersed the data 
in the lvm partitions to the new sata drives, I need to re-partition it with 
only two (instead of three) partitions.  The last time I did something like 
this, I lost a lvm physical volume because (i think) you can't rewrite the 
partition table on disk with the root filesystem.  What are the steps to 
safely repartition the disk with the root filesystem?

Thanks 


-- 
Alan Chandler
http://www.chandlerfamily.org.uk



Reply to: