Resizing sda1 on google cloud SUSE

Hello,
I am using a VM image provided by SAP on google cloud which runs on SUSE. The original configuration of the image was 36 GB, however when I created the image I increased it to 120 GB as I knew I will have to install few other components to it. When I ssh into the system I see that the /dev/sda1 is allocated only 36GB.

> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 13G 0 13G 0% /dev tmpfs 13G 0 13G 0% /dev/shm tmpfs 13G 9.7M 13G 1% /run tmpfs 13G 0 13G 0% /sys/fs/cgroup /dev/sda1 36G 33G 661M 99% / tmpfs 2.6G 0 2.6G 0% /run/user/490 tmpfs 2.6G 0 2.6G 0% /run/user/1004 tmpfs 2.6G 0 2.6G 0% /run/user/1005

But the disksize available is 120GB.

> sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 120G 0 disk └─sda1 8:1 0 36G 0 part /

How do I allocate more space from sda to sda1 ?

Could you show us the partition table for the disk/device as well as the
filesystems in use?

fdisk -l /dev/sda
mount | grep sda

The things I usually try include using ‘yast disk’ (Partitioner) to resize
the disk, though that may not work for the root filesystem while it is
online, and may depend on the filesystem used and partitions on the disk
(see commands above), or else I would try ‘parted’.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.

If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.

> sudo /usr/sbin/fdisk -l /dev/sda Disk /dev/sda: 120 GiB, 128849018880 bytes, 251658240 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x57830789 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 75489434 75487387 36G 83 Linux

> mount | grep sda /dev/sda1 on / type ext4 (rw,relatime,data=ordered)

On 05/03/2017 01:54 PM, kvothe wrote:[color=blue]

Code:
--------------------[color=green]
> sudo /usr/sbin/fdisk -l /dev/sda[/color]
Disk /dev/sda: 120 GiB, 128849018880 bytes, 251658240 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x57830789
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 75489434 75487387 36G 83 Linux
--------------------[/color]

That’s great; only the one partition, so in theory you should be able to
grow it, and the filesystem within.
[color=blue]

Code:
--------------------[color=green]
> mount | grep sda[/color]
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)
--------------------[/color]

The only question remaining is whether or not this can be done, with ext4
or even just the partition under it, while the system is running from that
partition. I’m 99.999% sure you can do it if you were to boot from other
media, but I do not know how you would do that with a Google Compute (or
any other cloud) instance; if you can do it online, then try Yast’s
Partitioner first:

sudo /sbin/yast disk

else, try ‘parted’.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.

If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.

I don’t think booting from other device is an option unfortunately. Here is what google says about resizing.

Resizing root disk.

This is the image that I used to create my system. The default on it was 36GB which I increased to 120 while creating my instance. But it still assigned 36 to root disk while keeping rest of it for itself. I followed the second link option and changed it to 125 GB but it still kept extra 5 gigs for itself :smiley:

On 05/03/2017 03:44 PM, kvothe wrote:[color=blue]

I don’t think booting from other device is an option unfortunately. Here
is what google says about ‘resizing’
(https://cloud.google.com/compute/docs/disks/add-persistent-disk).

‘Resizing root disk.’
(https://cloud.google.com/compute/docs/disks/create-root-persistent-disks#resizingrootpd)

This is ‘the image’
(https://console.cloud.google.com/launcher/details/sap-public/sap-hana-express?project=hxe-project)
that I used to create my system. The default on it was 36GB which I
increased to 120 while creating my instance. But it still assigned 36 to
root disk while keeping rest of it for itself. I followed the second
link option and changed it to 125 GB but it still kept extra 5 gigs for
itself :D[/color]

It sounds like you have it resized, but maybe not. If not, my next push
would be to create a new persistent disk, mount it where you need it, and
then use that going forward since, in my experience, this works better on
all types of systems (physical virtual, etc.) since 99.9% of reasons to
grow disks are application-specific, meaning they have their own
directories where large data things reside (binary data like databases or
VMs or images) and that is ideally suited to the flexibility that comes
from mountpoints.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.

If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.

I also think the resizing is done because when I use resize2fs it says the filesystem is already 9435923 blocks long which makes me think I just need to allocate more space to the partition somehow. I contacted google support and they ask me to use gcloud api command gcloud compute disks resize . But apparentlyresize is not a valid parameter :stuck_out_tongue:
I have contacted them again and I will probably create another disk if need be. But this I assumed should have been easier than all the hoops I am jumping through specially when the instance was created with sufficient space to begin with.

Edit:
I just saw this page . It lists the OS which support automatic resizing. Do you think SUSE is the reason its not happening?

[QUOTE=kvothe;37711]Resizing root disk.

This is the image that I used to create my system. The default on it was 36GB which I increased to 120 while creating my instance. But it still assigned 36 to root disk while keeping rest of it for itself. I followed the second link option and changed it to 125 GB but it still kept extra 5 gigs for itself :D[/QUOTE]

[QUOTE=kvothe;37717]I also think the resizing is done because when I use resize2fs it says the filesystem is already 9435923 blocks long which makes me think I just need to allocate more space to the partition somehow. I contacted google support and they ask me to use gcloud api command gcloud compute disks resize . But apparentlyresize is not a valid parameter :stuck_out_tongue:
I have contacted them again and I will probably create another disk if need be. But this I assumed should have been easier than all the hoops I am jumping through specially when the instance was created with sufficient space to begin with.

Edit:
I just saw this page . It lists the OS which support automatic resizing. Do you think SUSE is the reason its not happening?[/QUOTE]

I’m the exact same situation: SAP HANA Express image on GCE (Suse Enterprise). The automatic disk resizing does not work for it (Suse is not supported by GCE). Did you find a solution to resize the boot/root (/) partition?

HI frable90,

resize the partition to reach to the end of the disk, then reboot, then resize the file system.

Alternatively, switch to using more than one file system. You’d create additional partitions on the disk and use it for the additional file systems, or start using LVM for that (which I’d recommend anyhow, despite this being a cloud machine).

Regards,
J