Re: Upgrading to larger HD with LVM

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



Quoting Paul <unix@xxxxxxxxxxxxxx>:

I could dd it back and start from scratch.  I see that fdisk must be run
to resize the partition, then run pvresize.  I was under the impression
that changing the partition with fdisk will lose any data on it?

As long as the start of partition does not change (or in other words, partition only gets resized, but not moved), you will not loose any data. The steps are:

1. Expanding file system
   - expand partition using fdisk
   - expand physical volume
   - expand logical volume
   - expand file system

2. Shrinking file system
   - shrink file system
   - shrink logical volume
   - shrink physical volume (currently not always possible)
   - shrink partition

Here's what I have.  Yes, I am running LVM2, latest updates on Centos4.4:

# fdisk -l

Disk /dev/hda: 41.1 GB, 41174138880 bytes
255 heads, 63 sectors/track, 5005 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        2501    19984860   8e  Linux LVM

So you'd just recreate hda2 to start at the cylinder 14 and end the end of the disk. Also make sure the ID stays 8e (Linux LVM).

# fdisk /dev/hda2

Well, you can't fdisk /dev/hda2. It's partition. Hopefully you haven't exited from fdisk using "w" command (it could really screw up whatever was on hda2). You probably wanted to "fdisk /dev/hda".


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux