Re: Help: resizing partitions on a production server!
- From: Roger Leigh <${rleigh}@invalid.whinlatter.ukfsn.org.invalid>
- Date: Sun, 29 Jan 2006 11:08:03 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Simon Brooke <simon@xxxxxxxxxxxxxx> writes:
> in message <87y811bz83.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Roger
> Leigh ('${rleigh}@invalid.whinlatter.ukfsn.org.invalid') wrote:
>> Assuming your raid device has LVM running on top of it, you can add
>> the second disk as a PV and migrate the volumes across without any
>> messing around (pvmove). You can then repartition the first disk and
>> migrate them back.
>>
>> One thing to consider is your swap usage. It's quite small, and if
>> you're using RAID for your data, why aren't you using it for your swap
>> as well? (It's another point of failure.) If you're using LVM on
>> RAID, just add the swap as an LV. This would also allow you to merge
>> the first two partitions without touching the third.
>
> OK, forgive me for being very stupid. It's important I don't get this
> wrong!
>
> No, I didn't have LVM running. I hadn't (yet) seen the advantage of
> another layer of software redirection between the system and the
> hardware. But obviously if I had had I might not be in this mess,
> because logical volumes can in principle be moved about. So persuade me.
LVM is just one of those things which is really useful, making
management of your disk space a lot more flexible than fixed
partitions (as you have found). I've used it since shortly after it
went into the kernel, and it's been of great benefit to me.
LVM should really be the default when doing new installations, and
this is in fact the case for some new distributions (e.g. FC4).
Pretty much all of them allow one to set it up during installation.
> I have two physical devices. I've got as far as switching to the root
> file system now being only on /dev/hda3, and I've repartitioned /dev/hdb
> as follows:
>
> /dev/hdb1 1 8 64228+ 83 Linux
> /dev/hdb2 9 70 498015 82 Linux swap
> /dev/hdb3 71 10011 79851082+ 83 Linux
>
> I've then created a LV group (called 'main') and added an LV (called
> 'root') to it. I've added to it as physical volumes both hdb1 and hdb3,
> and I've tarred across all the data from hda3, so mount now gives
>
> /dev/hda3 on / type ext3 (rw,errors=remount-ro)
> proc on /proc type proc (rw)
> sysfs on /sys type sysfs (rw)
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
> tmpfs on /dev/shm type tmpfs (rw)
> /dev/hda1 on /boot type ext3 (rw)
> usbfs on /proc/bus/usb type usbfs (rw)
> /dev/mapper/main-root on /mnt type ext3 (rw)
>
> and df gives
>
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/hda3 78652836 2007456 72650016 3% /
> tmpfs 127956 0 127956 0% /dev/shm
> /dev/hda1 7746 7725 0 100% /boot
> /dev/mapper/main-root
> 78654392 2040932 72618020 3% /mnt
>
> And now I'm stuck and don't know what to do next.
OK. You will have trouble with root on LVM on RAID. You'll probably
need a special initrd/initramfs to boot such a beast. I always had a
separate boot disk and RAID array. Note that the LVM metadata is kept
in /etc, so having / on LVM is not a good plan in general (but by all
means put in on a separate RAID array).
> The only way I can see to repartition hda and move my data back is to
> boot with Tom's Rootboot or equivalent (actually probably Knoppix, as I
> don't suppose TRB, wondeful though it is, knows about logical volumes).
> Having done that, how do I build a RAID array with logical volumes? And
> if one physical drive fails, can I still recover my data as I would have
> been able to if I hadn't started messing with LVs?
You need to create the RAID array to start with. Once this is
running, even if only on a single disk, you can run pvcreate on
/dev/md0 and then create a new volume group containing just this PV.
You can then create and mount your LVs and copy the data across from
the other disk. Finally, you can add the other disk to your RAID
array.
> Finally, it was probably a mistake to add the tiny hdb1 partition to the
> logical volume. How can I safely remove it without losing data?
pvmove to move all the extents from hdb1 to hdb3, then it's safe to
vgreduce and pvremove.
If you have physical access to the system, you may find a backup and
restore, or a full reinstall are quicker and safer than shuffling
everything around.
Regards,
Roger.
- --
Roger Leigh
Printing on GNU/Linux? http://gutenprint.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>
iD8DBQFD3KISVcFcaSW/uEgRAg9LAJ9kRUupy93rlq4qQkjr5JYLA3bSSwCeIrH3
J/YCS3GQ3cKDm6xCXtKK3Ss=
=tEgc
-----END PGP SIGNATURE-----
.
- Follow-Ups:
- Re: Help: resizing partitions on a production server!
- From: Nix
- Re: Help: resizing partitions on a production server!
- From: Simon Brooke
- Re: Help: resizing partitions on a production server!
- From: Guy Fawkes
- Re: Help: resizing partitions on a production server!
- References:
- Help: resizing partitions on a production server!
- From: Simon Brooke
- Re: Help: resizing partitions on a production server!
- From: Roger Leigh
- Re: Help: resizing partitions on a production server!
- From: Simon Brooke
- Help: resizing partitions on a production server!
- Prev by Date: Re: CompareSoft ripping off GPL products?
- Next by Date: Building a Kernel - Debian Sarge
- Previous by thread: Re: Help: resizing partitions on a production server!
- Next by thread: Re: Help: resizing partitions on a production server!
- Index(es):
Relevant Pages
|
|