0

I am new to Ubuntu 14.04. We have a Server running on Ubuntu 14.04 and my requirement is to shrink the /var Filesystem (ext4) and create a new partition using that released space from the volume related to /var FS.

Note - We don't have storage to allocate to this server. Could someone please help me?

FYI, Only one VG is created on the server

root@Belga:~# fdisk -l

Disk /dev/sda: 429.5 GB, 429496729600 bytes
255 heads, 63 sectors/track, 52216 cylinders, total 838860800 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: 0x0000b970

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   838858751   419178497    5  Extended
/dev/sda5          501760   838858751   419178496   8e  Linux LVM

Disk /dev/mapper/Belga--vg-swap_1: 8585 MB, 8585740288 bytes
255 heads, 63 sectors/track, 1043 cylinders, total 16769024 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/mapper/Belga--vg-swap_1 doesn't contain a valid partition table

Disk /dev/mapper/Belga--vg-root: 25.0 GB, 24998051840 bytes
255 heads, 63 sectors/track, 3039 cylinders, total 48824320 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/mapper/Belga--vg-root doesn't contain a valid partition table

Disk /dev/mapper/Belga--vg-var: 363.9 GB, 363906203648 bytes
255 heads, 63 sectors/track, 44242 cylinders, total 710754304 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/mapper/Belga--vg-var doesn't contain a valid partition table

Disk /dev/mapper/Belga--vg-tmp: 1996 MB, 1996488704 bytes
255 heads, 63 sectors/track, 242 cylinders, total 3899392 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/mapper/Belga--vg-tmp doesn't contain a valid partition table

root@Belga:~#

root@Belga:~# vgs
  VG             #PV #LV #SN Attr   VSize   VFree

  Belga-vg   1   4   0 wz--n- 399.76g 27.71g

root@Belga:~# lvs
  LV     VG             Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
  root   Belga-vg -wi-ao---  23.28g
  swap_1 Belga-vg -wi-ao---   8.00g
  tmp    Belga-vg -wi-ao---   1.86g
  var    Belga-vg -wi-ao--- 338.91g
root@Belga:~#

root@Belga:~# df -h
Filesystem                                         Size  Used Avail Use% Mounted on
/dev/mapper/Belga--vg-root                    23G   19G  3.1G  86% /
udev                                               4.9G   12K  4.9G   1% /dev
tmpfs                                             1001M  644K 1000M   1% /run
/dev/mapper/Belga--vg-var                    334G  240G   80G  76% /var
/dev/mapper/Belga--vg-tmp                    1.8G  596M  1.2G  35% /tmp
bummi
  • 394
  • 3
  • 9
  • 14
  • 1
    Can you post the fdisk -l listing? Also, what do you mean by VG? – psukys Mar 27 '15 at 12:48
  • Is this Ubuntu Server or normal Ubuntu? Do you have access to a graphical environment or do you need commandline solutions? – terdon Mar 27 '15 at 12:49
  • fdisk -l output is posted FYI.

    VG - Volume group

    No access to Graphical Environment

    I would need command line solutions

    It is Ubuntu Server

    – harish kumar Mar 27 '15 at 14:05
  • Does this question have any relevance? http://askubuntu.com/questions/196125/how-can-i-resize-an-lvm-partition-i-e-physical-volume – psukys Mar 27 '15 at 21:05
  • 1
    It is best to resize partitions from a live CD. You can upsize a LVM partition easily, but down sizing is not always so easy. On a live CD try installing (and running) system-config-lvm – Panther Mar 28 '15 at 01:20

1 Answers1

0

Well, I usually do it this way:

  • boot any debian based live system from CD
  • backup your disk
  • sudo apt-get install gparted (if not already installed)
  • sudo gparted &
  • shrink your partition
  • create a new partition

any questions?

JPT
  • 369