linuxgoogle-cloud-platformgoogle-compute-enginediskdisk-partitioning

Increase filesystem mounted on /home/jupyter in Google Compute Engine


I'm working on a Google Compute Engine instance (through the Notebook instance in AI Platform).

I'm running a disk-intensive job (Neo4J on docker) and I've decided to both increase the root disk and attach another one.

When I run df -h, this is what I see:

Filesystem      Size  Used Avail Use% Mounted on
udev            119G     0  119G   0% /dev
tmpfs            24G  8.7M   24G   1% /run
/dev/sda1       985G   13G  932G   2% /
tmpfs           119G     0  119G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           119G     0  119G   0% /sys/fs/cgroup
/dev/sda15      124M  5.7M  119M   5% /boot/efi
/dev/sdb         98G   62M   98G   1% /home/jupyter

And when I run sudo lsblk, this is what I see:

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0  1000G  0 disk 
├─sda1    8:1    0 999.9G  0 part /
├─sda14   8:14   0     3M  0 part 
└─sda15   8:15   0   124M  0 part /boot/efi
sdb       8:16   0  1000G  0 disk /home/jupyter

As you can see I have 2 disks each of size 1000G. Anyway, even if sdb has size 1000G, just 98G seem available for use and this causes my job to crash.

Is there anyway I can increase that?

Thank you in advance


Solution

  • Using the Logical Volume manager in Linux, you can increase the size of the file system.

    Logical Volume Manager (LVM) is used in Linux to manage hard drives and other storage devices. As the name implies, it can sort raw storage into logical volumes, making it easy to configure and use. link

    Before using LVM to increase the size of your Filesystem please consider:

    You can grow a file system to the maximum space available on the device, or specify an exact size. Ensure that you grow the size of the device or logical volume before you attempt to increase the size of the file system.

    When specifying an exact size for the file system, ensure that the new size satisfies the following conditions:

    • The new size must be greater than the size of the existing data; otherwise, data loss occurs.
    • The new size must be equal to or less than the current device size because the file system size cannot extend beyond the space
      available.

    To resize the File system:

    The size of a Btrfs file system can be changed by using the btrfs filesystem resize

    sudo btrfs filesystem resize max /mnt
    

    The size of an XFS file system can be increased by using the xfs_growfs command

    sudo xfs_growfs -d /mnt
    

    The size of Ext2, Ext3, and Ext4 file systems can be increased by using the resize2fs command

    sudo resize2fs /dev/sda1
    

    In this link, you can find more information about Resizing file Systems.