4

I was given a CentOS 9 Linux distribution server inside a virtual machine to whom I can connect using ssh protocol (from command line). I am running svn checkout command in order to clone a remote repository, whose size is around 10GB, into my workspace in CentOS /home/<user>/my/workspace, but after some time I get:

No space left on device

And the procedure fails.

If I run df -h command I get:

Filesystem                    Size  Used Avail Use% Mounted on
devtmpfs                      4.0M     0  4.0M   0% /dev
tmpfs                         7.7G     0  7.7G   0% /dev/shm
tmpfs                         3.1G  1.4M  3.1G   1% /run
efivarfs                      256K   31K  221K  13% /sys/firmware/efi/efivars
/dev/mapper/cs-root           9.4G  1.1G  8.4G  11% /
/dev/mapper/cs-usr            7.5G  5.0G  2.5G  67% /usr
tmpfs                         1.0G     0  1.0G   0% /tmp
/dev/mapper/cs-var            7.5G  949M  6.6G  13% /var
/dev/sda2                     947M  507M  441M  54% /boot
/dev/mapper/cs-var_tmp        1.9G   46M  1.9G   3% /var/tmp
/dev/mapper/cs-opt            7.5G  112M  7.4G   2% /opt
/dev/sda1                     571M  7.5M  564M   2% /boot/efi
/dev/mapper/cs-home           7.5G  7.5G   20K 100% /home
/dev/mapper/cs-var_log        3.8G  584M  3.2G  16% /var/log
/dev/mapper/cs-var_log_audit  3.8G  3.3G  524M  87% /var/log/audit
tmpfs                         1.6G   28K  1.6G   1% /run/user/974
tmpfs                         1.6G   28K  1.6G   1% /run/user/582851889

And, as you can see, /home directory is full at 100% (Size is 7.5G, Used is 7.5G, Avail is 20K).

How can I increase the space available to make the svn checkout command successful?

Also, the output of lsblk command is:

NAME                 MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                    8:0    0    1T  0 disk
├─sda1                 8:1    0  572M  0 part /boot/efi
├─sda2                 8:2    0  953M  0 part /boot
├─sda3                 8:3    0 54.2G  0 part
│ ├─cs-root          253:0    0  9.3G  0 lvm  /
│ ├─cs-swap          253:1    0  3.7G  0 lvm  [SWAP]
│ ├─cs-usr           253:2    0  7.5G  0 lvm  /usr
│ ├─cs-opt           253:3    0  7.5G  0 lvm  /opt
│ ├─cs-home          253:4    0  7.5G  0 lvm  /home
│ ├─cs-var_log_audit 253:5    0  3.7G  0 lvm  /var/log/audit
│ ├─cs-var           253:6    0  7.5G  0 lvm  /var
│ ├─cs-tmp           253:7    0    2G  0 lvm
│ ├─cs-var_log       253:8    0  3.7G  0 lvm  /var/log
│ └─cs-var_tmp       253:9    0  1.9G  0 lvm  /var/tmp
└─sda4                 8:4    0    1M  0 part
sr0                   11:0    1 1024M  0 rom

And the output of vgs command is:

  VG #PV #LV #SN Attr   VSize   VFree
  cs   1  10   0 wz--n- <54.18g 4.00m

The output of parted -l command is:

Model: VMware Virtual disk (scsi)
Disk /dev/sda: 1100GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags 1 1049kB 601MB 600MB fat32 EFI System Partition boot, esp 2 601MB 1600MB 999MB xfs 3 1600MB 59.8GB 58.2GB lvm 4 59.8GB 59.8GB 1049kB bios_grub

My idea is to grasp unallocated space from /dev/sda disk and allocate around 50GB (or more) to /home.

Since I am new to disk partitioning and management on Linux, is that a good idea? How do I accomplish this?

tail
  • 171

2 Answers2

1

Here's a common method to expand, which assumes there is more free space on the disk. There are plenty of other variations though, depending on how you want things organized:

  1. Add a new partition using fdisk or parted, either on sda or wherever you have free space.
    • You can check the disk for free space with parted -l
  2. Create and update the LVM objects as needed from the new partition. For example:
    • Add the whole partition as a Physical Volume: pvcreate /dev/sda5
    • Add the PV to your volume group: vgextend cs /dev/sda5
    • Add the whole PV to the home directory logical volume: lvextend /dev/cs/home /dev/sda5

You'll probably want to limit the size of your new partition. It's easy to add space this way, but often much harder to shrink it back down if you want to shuffle it around again later.

If the partitions use MBR (shown as Partition Table: msdos in parted -l), then it may be limited to 4 partitions. There are simple ways around it, but worth mentioning in case you run into issues with step 1

Cpt.Whale
  • 10,914
1

Since volume group cs free space is 4.00m (almost full), I solved this way:

1. Create a new partition

Since /dev/sda disk has much unallocated space, I can create a new partition for that disk:

sudo fdisk /dev/sda

In the dialog that will pop up, press n (new partition), p (partition type is primary), 5 (partition number), default first sector, +/-<size>{K,B,M,G,...} (space of the partition, in my case I may allocate +50G). Then change the partition type pressing t, and then 8e to set the partition type to Linux LVM. Finally, save the changes using w

2. Create a physical volume (PV)

Create a physical volume:

sudo pvcreate /dev/sda5

Verify the operation using sudo pvs

3. Extend the volume group (VG)

Extend the volume group cs:

sudo vgextend cs /dev/sda5

Verify the operation using sudo vgs

4. Extend the logical volume (LV)

Extend the logical volume and resize the file system cs-home:

sudo lvextend -L +<size> -r /dev/mapper/cs-home

I can use -l +<percentage>%FREE instead of -L. Note the -r flag to [resize underlying filesystem together with the logical volume][1]. Verify the operation using sudo df -h

I do not need to format the file system and mount it since I am extending an existing LV.

tail
  • 171