0

I am completely new to dealing with filesystems and disk. I have ssh access to a physical machine which has two physical disks I believe. When I do fdisk -l I get:

root@206-166-40-41-os-compute:/home/prjdefault# fdisk -l

Disk /dev/sda: 73.4 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders, total 143305920 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 1048576 bytes
I/O size (minimum/optimal): 1048576 bytes / 1048576 bytes
Alignment offset: 405504 bytes
Disk identifier: 0x0001d370

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   143296511    71647232   83  Linux
Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 73.4 GB, 73372631040 bytes
98 heads, 9 sectors/track, 162478 cylinders, total 143305920 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 1048576 bytes
I/O size (minimum/optimal): 1048576 bytes / 1048576 bytes
Alignment offset: 12288 bytes
Disk identifier: 0x1f7aafb8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              24   143305919    71652948   8e  Linux LVM

Disk /dev/mapper/vgroot-lvroot: 15.0 GB, 14998831104 bytes
255 heads, 63 sectors/track, 1823 cylinders, total 29294592 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 1048576 bytes
I/O size (minimum/optimal): 1048576 bytes / 1048576 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vgroot-lvroot doesn't contain a valid partition table

and df -h gives me:

root@206-166-40-41-os-compute:/home/prjdefault# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G  4.0K   16G   1% /dev
tmpfs           3.2G  556K  3.2G   1% /run
/dev/dm-0        14G  3.9G  9.1G  31% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none             16G     0   16G   0% /run/shm
none            100M     0  100M   0% /run/user

and pvdisplay -v :

root@206-166-40-41-os-compute:/home/prjdefault# pvdisplay -v
    Scanning for physical volume names
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               vgroot
  PV Size               68.33 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              17491
  Free PE               13915
  Allocated PE          3576
  PV UUID               oxpDr3-ZVTm-IPd9-Lgfq-wrfA-Z64o-zRS25Z

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vgroot
  PV Size               68.33 GiB / not usable 1.58 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              17493
  Free PE               17493
  Allocated PE          0
  PV UUID               psfXAo-HhvA-fl2S-RwA6-IuBX-pmRr-flej70

As can be seen from output of df I am almost already using up all my disk space. I need to use this machine as a database, I have the database installed but while loading the database I hit out of space error so I had to delete everything and now I am trying to utilize all the disk space from LVM volumes but I cannot figure out how to do it. I tried following this tutorial but I did not know where to mount the new partition so it can add space to my home directory?

My question might be unclear as I am not familiar with the filesystems jargon in linux.

Edit: Also adding pvdisplay -m just in case, as well as vgs, lvs:

root@206-166-40-41-os-compute:/home/prjdefault# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               vgroot
  PV Size               68.33 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              17491
  Free PE               13915
  Allocated PE          3576
  PV UUID               oxpDr3-ZVTm-IPd9-Lgfq-wrfA-Z64o-zRS25Z

  --- Physical Segments ---
  Physical extent 0 to 3575:
    Logical volume      /dev/vgroot/lvroot
    Logical extents     0 to 3575
  Physical extent 3576 to 17490:
    FREE

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vgroot
  PV Size               68.33 GiB / not usable 1.58 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              17493
  Free PE               17493
  Allocated PE          0
  PV UUID               psfXAo-HhvA-fl2S-RwA6-IuBX-pmRr-flej70

  --- Physical Segments ---
  Physical extent 0 to 17492:
    FREE

prjdefault@206-166-40-41-os-compute:~$ sudo vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  vgroot   2   1   0 wz--n- 136.66g 122.69g
prjdefault@206-166-40-41-os-compute:~$ sudo lvs
  LV     VG     Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  lvroot vgroot -wi-ao--- 13.97g
  • Please add to the question the output of vgs and lvs – Stephen Harris Sep 6 '16 at 23:03
  • according to the info you already posted you have a plenty of free space in your volume group. You just need to extend the logical volume of your choice (or create a new one, for example, if you wish your DB data to be placed onto a separate volume, which is a good idea in general). see man lvextend and man lvcreate – Serge Sep 6 '16 at 23:08
1

It seems like LVM is configured on your machine, with free space, which is a good thing in this situation. None of the commands you've shown the output of tells us what filesystem you're using, so we don't know how easy it will be to extend you filesystem, so my recommandation would be to make a new logical volume (with filesystem on it of course) for the database data you want.

(You can consider making a new volume group, but I don't see any advantage in your setup)

You make a new volume with lvcreate --size <N>G -n db_data vg_root where <N> is the number of gigabytes you want (you have around 100G free, but I doubt your database will be that big, and you might want space for other things later, and for performance - which can be interesting with databases - stay below 68, so it can all be on one disk, to do that just add /dev/sdb1 to the command.

You make a filesystem on the new logical volume with e.g. mkfs.ext4 /dev/mapper/vg_root (if you want ext4, there's a lot of other options).

Where to mount it depends on what RDBMS you want to use, for postgresql (the only one I remember the answer for) it should be /var/lib/postgresql/<version>/main/base (main is probably the cluster name, but if you have more or a different name, you'll know), and to get your new fs mounted there on every boot add something like:

/dev/mapper/vg_root/db_data /<mountpoint> ext4 defaults 0 0

to /etc/fstab. If you used something else that ext4 as fs, substitute that that, and add spaces so it lines up nicely with what you already have in that file.

0

Since lvs was only showing one logical volume:

prjdefault@206-166-40-41-os-compute:~$ sudo lvs
  LV     VG     Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  lvroot vgroot -wi-ao--- 13.97g

I decided to take a shot at extending it:

sudo lvextend -L+100G /dev/vgroot/lvroot

And then did a reboot, and it worked:

prjdefault@206-166-40-41-os-compute:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G  4.0K   16G   1% /dev
tmpfs           3.2G  556K  3.2G   1% /run
/dev/dm-0       113G  4.0G  104G   4% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M  4.0K  5.0M   1% /run/lock
none             16G     0   16G   0% /run/shm
none            100M     0  100M   0% /run/user
prjdefault@206-166-40-41-os-compute:~$ sudo vgs
[sudo] password for prjdefault:
  VG     #PV #LV #SN Attr   VSize   VFree
  vgroot   2   1   0 wz--n- 136.66g 22.69g
prjdefault@206-166-40-41-os-compute:~$ sudo lvs
  LV     VG     Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
  lvroot vgroot -wi-ao--- 113.97g

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.