0

What we have?

df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            967M     0  967M   0% /dev
tmpfs           200M  7.8M  192M   4% /run
/dev/xvda2       28G   26G  180M 100% /
tmpfs           999M     0  999M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           999M     0  999M   0% /sys/fs/cgroup

fdisk -l

Disk /dev/xvda2: 48 GiB, 51539607552 bytes, 100663296 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 /dev/xvda1: 1 GiB, 1073741824 bytes, 2097152 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

ls /dev | grep xvda

xvda1
xvda2

lsblk

NAME  MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1    0   1G  0 disk [SWAP]
xvda2 202:2    0  48G  0 disk /

cat /proc/partitions

major minor  #blocks  name

 202        2   50331648 xvda2
 202        1    1048576 xvda1

I don't undersand:

  • Where is /dev/xvda?
  • What happened with 20Gb on /dev/xvda2?
  • How to use the currently unused 20Gb?

UPD1

cat /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
devpts          /dev/pts        devpts  rw,noexec,nosuid,gid=5,mode=620 0  0
/dev/xvda1 none swap sw 0 0
/dev/xvda2 / ext4 defaults 0 1
5
  • What filesystem are you using? ext2/3/4?
    – Attie
    Commented Mar 28, 2018 at 7:52
  • Please edit your question for clarity - are you asking how to use the currently unused ~20GB, or are you asking how to add further storage?
    – Attie
    Commented Mar 28, 2018 at 8:05
  • Can you share the output of "cat /etc/fstab" Commented Mar 28, 2018 at 8:11
  • @Gefolge, see UPD1 Commented Mar 28, 2018 at 8:14
  • @Attie, i fix question title, thx Commented Mar 28, 2018 at 8:16

2 Answers 2

1

xvd* is a "Virtual Disk"... probably backed by a file by the hypervisor. It looks like you're using Xen as the hypervisor.

From the output you've posted, we can see that you have a 48GB partition, with a filesystem that is only using the first 28GB.

Thus, you need to expand the filesystem to use the whole partition - they are two independent things.

If you're using ext2/3/4 then you can use the following, which can be performed while the filesystem is mounted / online. This will automatically extend the filesystem to the length of the underlying device.

resize2fs /dev/xvda2
2

You can add a new hard disk as virtual and you can extend the filesystem with below commands:

physicaldisk=/dev/sdxx                            # Physical Disk Name
vgname=vg_root                                   # Volume Group Name
lvname=lv_root                                   # Logical Volume Name
dirname=/                                    # Mount path
pvcreate $physicaldisk
vgextend $vgname $physicaldisk
lvextend -l +100%FREE /dev/vg_vgname/lv_lvname
resize2fs /dev/vg_vgname/lv_lvname

If you extend a filesystem you should a create physcial volume from a new hard disk firstly and then you should extend the volume group that realted the filesystem.

After extending of VG, you can extend Logical Volume with this new space. Because there are new space in VG for LV can extend.

And fianlly you must resize the filesystem with suitable command by your filesystem. (xfs_grows or resize2fs)

3
  • There is not a single mention of LVM in the question... / is mounted on /dev/xvda2.
    – Attie
    Commented Mar 28, 2018 at 7:55
  • Sorry, yes you're right @Attie. This answer is for LVM but logic is general disk logic. Commented Mar 28, 2018 at 8:01
  • 1
    @Gefolge, thx for answer. I'm sure it will come in handy. Commented Mar 28, 2018 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .