Shrink the /tmp partition in 500 MiB and expand the / partition with those 500 MiB

Shrink /tmp

_$: lsof | grep /tmp
_$: umount /tmp
_$: e2fsck -f /dev/mapper/vg00-lvtmp
e2fsck 1.42 (29-Nov-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg00-lvtmp: 11/60928 files (0.0% non-contiguous), 8231/243712 blocks

We reduce the volume group to 500 MiB

_$: resize2fs /dev/mapper/vg00-lvtmp 500M
resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/mapper/vg00-lvtmp to 128000 (4k) blocks.
The filesystem on /dev/mapper/vg00-lvtmp is now 128000 blocks long.

And we reduce the logical volume to 500 MiB

_$: lvresize -L500M /dev/vg00/lvtmp
  WARNING: Reducing active logical volume to 500.00 MiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvtmp? [y/n]: y
  Reducing logical volume lvtmp to 500.00 MiB
  Logical volume lvtmp successfully resized
_$: lvdisplay /dev/vg00/lvtmp 
  --- Logical volume ---
  LV Name                /dev/vg00/lvtmp
  VG Name                vg00
  LV UUID                6b2e73-eUpm-wq3p-iyE7-nqqE-GqxR-0W1U6K
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                500.00 MiB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
_$: mount /dev/mapper/vg00-lvtmp

Expand /

Resize the logical volume. You may find that you cannot use the whole 500 MiB, so use the maximum you can:

_$: lvresize -L +450M /dev/mapper/vg00-lvroot
_$: lvdisplay /dev/vg00/lvroot
  --- Logical volume ---
  LV Name                /dev/vg00/lvroot
  VG Name                vg00
  LV UUID                90o7dF-KALR-6cWV-YGRg-we0m-HIJ6-m1Ryk0
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.37 GiB
  Current LE             351
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

And resize the volume group:

_$: resize2fs -p /dev/mapper/vg00-lvroot
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/mapper/vg00-lvroot is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/vg00-lvroot to 359424 (4k) blocks.
The filesystem on /dev/mapper/vg00-lvroot is now 359424 blocks long.
_$: df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/vg00-lvroot   1.4G  899M  431M  68% /
udev                      489M  4.0K  489M   1% /dev
tmpfs                     200M  288K  199M   1% /run
none                      5.0M     0  5.0M   0% /run/lock
none                      498M     0  498M   0% /run/shm
/dev/vda1                 938M   42M  849M   5% /boot
/dev/mapper/vg00-lvtmp    498M   22M  451M   5% /tmp
/dev/mapper/vg00-lvvar    949M  383M  519M  43% /var
/dev/mapper/vg00-lvvmail  3.4G  114M  3.1G   4% /var/vmail

Expand a partition with an added hard disk

Add hard disk

Power off the virtual machine. Add from VirtualBox the new hard disk. Power on the virtual machine. Check that there is a new hard disk:

_$: fdisk -l /dev/sd?

Disk /dev/sda: 53.7 GB, 53687091200 bytes
...

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

So the new hard disk appears as /dev/sdb.

Create a partition in the hard disk

_$: fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3c97a9f9.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 
Using default value 41943039

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L
...
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Expand /var partition

_$: pvcreate /dev/sdb1

_$: vgdisplay
  --- Volume group ---
  VG Name               vg00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               48.13 GiB
  PE Size               4.00 MiB
  Total PE              12322
  Alloc PE / Size       12322 / 48.13 GiB
  Free  PE / Size       0 / 0
  VG UUID               vNasCi-SgMs-VhVQ-f7OO-Pigq-pkpy-u0ocwC

_$: vgdisplay | grep Name
  VG Name               vg00

_$: vgextend vg00 /dev/sdb1

_$: pvscan
  PV /dev/sda5   VG vg00   lvm2 [48.13 GiB / 0    free]
  PV /dev/sdb1   VG vg00   lvm2 [20.00 GiB / 20.00 GiB free]
  Total: 2 [68.13 GiB] / in use: 2 [68.13 GiB] / in no VG: 0 [0   ]

_$: lvdisplay
...
  --- Logical volume ---
  LV Name                /dev/vg00/lvvar                        <===
  VG Name                vg00
  LV UUID                weS5dG-8c3G-HRFx-wVLA-P5Mq-uizk-S3uyrg
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                9.31 GiB                               <===
  Current LE             2384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
...

_$: lvextend /dev/vg00/lvvar /dev/sdb1
  Extending logical volume lvvar to 29.31 GiB
  Logical volume lvvar successfully resized

Check it:

_$: lvdisplay
...
  --- Logical volume ---
  LV Name                /dev/vg00/lvvar
  VG Name                vg00
  LV UUID                weS5dG-8c3G-HRFx-wVLA-P5Mq-uizk-S3uyrg
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                29.31 GiB                              <===
  Current LE             7503
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
...
_$: resize2fs /dev/vg00/lvvar   # Wait for some time (1 minute)
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/vg00/lvvar is mounted on /var; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg00/lvvar to 7683072 (4k) blocks.
The filesystem on /dev/vg00/lvvar is now 7683072 blocks long.

_$: df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/vg00-lvroot ext4      9.2G  3.9G  4.9G  44% /
udev                    devtmpfs  489M  172K  489M   1% /dev
tmpfs                   tmpfs     100M  472K  100M   1% /run
none                    tmpfs     5.0M     0  5.0M   0% /run/lock
none                    tmpfs     498M     0  498M   0% /run/shm
/dev/sda1               ext3      938M  338M  553M  38% /boot
/dev/mapper/vg00-lvsrv  ext4       30G   23G  5.1G  82% /srv
/dev/mapper/vg00-lvvar  ext4       29G  9.2G   19G  34% /var    <===