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

Re: Debian in a VMware VM and LVM



On Tue, Mar 13, 2012 at 10:52 AM, Bonno Bloksma <b.bloksma@tio.nl> wrote:



> I have been using Linux for several years but now I have another learning
> moment. ;-) I have read several LVM howto sites but still run into things I
> do not understand.
> Can someone please answer the 4 embedded questions and tell me what
> I(?) did wrong.
>
> Using the 6.0.4 amd netinst CD I created a small 10GB virtual machine
> (VM). I then realized I needed it to be a bit bigger so I wanted to extend
> the LVM environment and add that space to the /var logical volume.
> Of course as this is a new VM I just could have started from scratch
> but I am trying to learn something as well. ;-)
>
> First I had a look at the current disk layout using fdisk -l
>
> root@wwwgw:~# fdisk -l
>
> Disk /dev/sda: 10.7 GB, 10737418240 bytes
> 255 heads, 63 sectors/track, 1305 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x000d6e97
>
>   Device Boot      Start         End      Blocks   Id  System
> /dev/sda1               1          37      291840   83  Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2              37        1306    10190849    5  Extended
> /dev/sda5              37        1306    10190848   8e  Linux LVM
>
> 1)
> Why the warning about the 300MB /boot partition not ending on a cylinder
> boundary? I used the manual setup in the Debian 6.0.4 installation and
> told it to create a 300MB partition at the beginning of the disk. Did
> the installation software do something wrong or should I have know
> something I do not know yet?

I've never liked this message and I therefore partition manually.
Someone else on the list might know whether you can incur a
performance hit on a "regular" disk; you certainly do with an SSD or
an "advanced format" disk. The wheezy installer corrects this and
starts at 2048 (units=sectors).



> 2)
> After that came a lot of warnings about /dev/dm-0, /dev/dm-1, /dev/dm-2,
> /dev/dm-3 and /dev/dm-4. I know those are LVM2 devices but...
> Why is fdisk (still) seeing them as disks/partitions it has to show during
> a listing, and then complain they are not valid?

I assume that "fdisk -l" goes through "/proc/partitions" and displays
the information that it can about its contents.

It doesn't recognize the device mapper devices because they are
virtual block devices created by dmsetup/lvm within a "real"/physical
block device.



> At the VMware level I increased the disk from 10GB to 12GB. Using
> cfdisk, which in my opinion gives less cause for a user error, I created
> a new logical sda6 partition in the free space. The end result is:
> root@wwwgw:~# fdisk -l
>
> Disk /dev/sda: 12.9 GB, 12884901888 bytes
> 255 heads, 63 sectors/track, 1566 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x000d6e97
>
>   Device Boot      Start         End      Blocks   Id  System
> /dev/sda1               1          37      291840   83  Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2              37        1566    12285008    5  Extended
> /dev/sda5              37        1306    10190848   8e  Linux LVM
> /dev/sda6            1306        1566     2094127+  8e  Linux

I've always assumed that it meant that the partition's size is between
2094127 and 2094128 blocks but assumption can be the mother of all
<deleted>!



> 3)
> Why is there a + at the end of the number of blocks?
>
> I then want to make the sda6 partition a LVM physical volume using
> root@wwwgw:~# pvcreate /dev/sda6
>  Device /dev/sda6 not found (or ignored by filtering).
> root@wwwgw:~#
> indeed, there is no /dev/sda6 yet.
>
> 4)
> Why is /dev/sda6 not there yet? What step am I missing?

I've never used cfdisk; don't you get a message that the kernel's
still using the old partition table?



> Ok, after a reboot (it is not a production server yet) the /dev/sda6 is there.
> Form here on it was (almost) straight sailing. ;-)

No need to reboot; partprobe or kpartx can load the new partition table for you.



> root@wwwgw:~# pvcreate /dev/sda6
>  Physical volume "/dev/sda6" successfully created
> root@wwwgw:~# vgextend vgroup1 /dev/sda6
>  Volume group "vgroup1" successfully extended
>
> Then to runlevel 1 to make sure (almost) nothing is using the /var directory tree
> and
> root@wwwgw:~# lvextend -l+2G /dev/vgroup1/lvvar
>  Extending logical volume lvvar to 3.86GiB
>  Logical volume lvvar successfully resized
>
> root@wwwgw:~# umount /var
> Then first a filesystem check as that seems to be needed before resizing. Not doing so will give me a warning although this was not mentioned in the HOWTOs I have read.
> root@wwwgw:~# fsck -f /dev/vgroup1/lvvar
> root@wwwgw:~# resize2fs /dev/vgroup1/lvvar
> root@wwwgw:~# mount /var
>
> and back to runlevel 2

I'm surprised that you were able to unmount "/var", even in runlevel
1, but I assume that it depends on your setup. Running fsck is a good
idea. You can also do so after "resize2fs ...".

I'd have booted via the network, a rescue CD, or a live CD to do this.
You could probably even do this via the initramfs (untested!).


Reply to: