[TriLUG] Problem with LVM
T. Bryan
tbryan at python.net
Tue May 2 07:15:35 EDT 2006
On Monday 01 May 2006 11:47 am, Rick DeNatale wrote:
> Here are the steps I took to move my root to an LVM on top of raid.
> I've copied this from the ticket I created for the job in request
> tracker, and have edited it slightly. I was quite cautious with this
> plan since I was migrating the root filesystem, which I don't think
> you are doing.
No. It was just a bunch of data I moved over from another disk. There are
some files on the new RAID/LVM that aren't anywhere else, but I can probably
stand to lose them if there's no other way than to start over. I'm just glad
that I found this problem before I moved /home over. :-)
> 1) Partition /dev/sdb like /dev/sda
>
> 2) Create the raid array with a missing drive
> $mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb5
Yeah. I saw these kinds of instructions for root filesystems. Since I wasn't
doing a root filesystem, I thought that I could just create the RAID with
both disks in the mirror and then work on /dev/md0. Like I said, I actually
used /dev/localvg/lv_local1 for a few weeks before doing a dist-upgrade and
upgrading my kernel. I didn't seem to have any problems until then.
> 3) Create a PV on the raid array
> 4) create a VG
> 5) Create the LVs
> 6) Format the LVs
> 7) Mount the new root LV
> 8) Copy the root partition
> 11) Edit /mnt/root/etc/fstab to use the md device. Of course your
> /etc/fstab would be different.
>
> /dev/sdb1 /boot ext3 defaults 0 2
> /dev/mapper/MainVG-root / ext3 defaults,errors=remount-ro
I also wonder about the change from /dev/volumegroup/logicalvolume
to /dev/mapper/volumegroup-logicalvolume. Mine was definitely originally
using /dev/localvg/lv_local1. Now, LVM seems to
expect /dev/mapper/localvg-lv_local1.
> 18) Now add /dev/sda5 to the raid
> $sudo mdadm --add /dev/md0 /dev/sda5
>
> This wipes the contents of /dev/sda5 and syncs it with /dev/sdb
I'm guessing that this is my best bet at this point. If I can't get anything
else working, just attempt to copy from one of the disks in the mirror to the
other. That shouldn't really lose any data, so it should be pretty safe.
> > Another question. What is your partition type for /dev/sda5 and
> > /dev/sdb5?
>
> $sudo fdisk -l /dev/sda /dev/sdb
> ...
> /dev/sda5 32 1106 8634906 8e Linux LVM
>
> Disk /dev/sdb: 9173 MB, 9173114880 bytes
> ...
> /dev/sdb5 32 1106 8634906 fd Linux raid
> autodetect
BTW, thanks for all of the great, detailed information!
> > None of the HOWTOs mentioned changing it, but I notice that partition
> > type 8e is Linux LVM, but mine is 83 (Linux) for ext3.
>
> I didn't do anything to explicitly change the partition type with
> fdisk/sfdisk. I beleive that they got that way as a side-effect of
> the mdadm and pvcreate commands. Given your symptoms I suspect that
> the problem isn't the 83 vs 8e, but the 83 vs fd partition types.
Ooh. Interesting.
I suppose that I could try setting them by hand just to see whether that
rescues me. Does anyone know whether changing a partition type is
non-destructive? That is, is it safe to change a partition type with fdisk,
reboot, change it back, and reboot again? Or would some vital information be
lost just by twiddling the partition type?
I'm thinking that I might get the fd partition type automatically by
rebuilding the RAID from one of the disks. I'm just not sure whether I
should set the other partition type to 8e first. If pvcreate was supposed to
set it, then I'm not sure why that didn't get set when I ran pvcreate.
Thanks,
---Tom
More information about the TriLUG
mailing list