All Products
Search
Document Center

SAP:Cloud disk capacity expansion Guide for SAP

Last Updated:Feb 24, 2023

Cloud disk capacity expansion Guide for SAP

Release history

Version

Revision date

Changes

Release date

1.0

2019-03-26

1.1

2019-03-29

1. Updated operation instructions for adding a data disk.

2. Updated document links.

2019-03-29

1.2

2019-04-02

1. Updated the reference for shrinking a disk.

2. Optimized the layout.

2019-04-02

1.3

2019-12-30

1. Updated the resize cloud disk online.

2019-12-30

Overview

This topic describes how to resize the SAP application or database disks on Alibaba Cloud. Disk resizing includes system disk resizing and data disk resizing. Before resizing a disk, read the instructions in

For more information about system disk resizing, see:

Resize cloud disks offline

After resizing a disk, you need to use file system-specific commands to resize the file system to a required size.

In some scenarios, you need to shrink a disk. For more information, see Shrink disk.

The following uses SUSE Linux Enterprise Server for SAP Applications 12 SP3 as an example. In this example, you use Logical Volume Manager (LVM) to manage disk partitions and file systems (XFS and Ext). The commands may vary according to versions or operating systems. For more information, see the manuals for the corresponding operating systems.

Assume that the /hana/data, /usr/sap, and /sapcd file systems of SAP applications need to be resized.

  • The /hana/data, /hana/log, and /hana/shared file systems are of the XFS type. These file systems stripe data across three SSDs based on LVM. This can improve the efficiency of data I/O for SAP HANA.

  • The /usr/sap partition is an XFS file system. This file system stores data in an ultra disk in a separate volume group.

  • The /sapcd partition is an Ext4 file system. This file system stores data in a raw disk that is not partitioned and managed by LVM.

Example

Disk type

File system size before resizing

File system size after resizing

File system type

Volume group

Striped based on LVM

Mount point

Data disk

30 GB

50 GB

XFS

datavg

Yes

/hana/data

Data disk

30 GB

60 GB

XFS

sapvg

No

/usr/sap

Data disk

20 GB

40 GB

Ext4

N/A

No

/sapcd

Note

Note We recommend that you create a snapshot of a disk before resizing the disk. This prevents data loss caused by maloperations. For more information, see Create a snapshot.

Data disk resizing

Create a data disk

You can add a data disk when a new file system is mounted, the capacity of a disk exceeds the upper limit, or multiple disks are striped based on LVM to enhance the I/O performance.

Example: Create a 20 GB disk and attach it to the /usr/sap/T01 file system.

1. Create a 20 GB disk in the Elastic Compute Service (ECS) console and attach the disk to an ECS instance. The system allocates a name to the disk, for example, /dev/vdg.

# lsblk
NAME               MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda                253:0    0  40G  0 disk 
└─vda1             253:1    0  40G  0 part /
vdb                253:16   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdc                253:32   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdd                253:48   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vde                253:64   0  60G  0 disk 
└─sapvg-lvusrsap   254:0    0  60G  0 lvm  /usr/sap
vdf                253:80   0  40G  0 disk /sapcd
vdg                253:96   0  20G  0 disk

2. Add the disk to an existing volume group and create a logical volume.

Add the disk to an existing volume group.

# vgextend sapvg /dev/vdg
  Volume group "sapvg" successfully extended

# pvs -a
  PV                    VG     Fmt  Attr PSize  PFree 
  /dev/datavg/lvhdata               ---      0      0 
  /dev/datavg/lvhlog                ---      0      0 
  /dev/datavg/lvhshared             ---      0      0 
  /dev/root                         ---      0      0 
  /dev/sapvg/lvusrsap               ---      0      0 
  /dev/vdb              datavg lvm2 a--  40.00g 13.33g
  /dev/vdc              datavg lvm2 a--  40.00g 13.33g
  /dev/vdd              datavg lvm2 a--  40.00g 13.33g
  /dev/vde              sapvg  lvm2 a--  60.00g     0 
  /dev/vdf                          ---      0      0 
  /dev/vdg              sapvg  lvm2 a--  20.00g 20.00g

# lvcreate -l 100%FREE -n lvsapsid sapvg
  Logical volume "lvsapsid" created.

# mkfs.xfs /dev/sapvg/lvsapsid 
meta-data=/dev/sapvg/lvsapsid    isize=256    agcount=4, agsize=1310464 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=5241856, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

3. Mount a new file system to the specified mount point.

Note

Note: Before you mount a new partition to a non-empty directory, move or copy all subdirectories and files to another directory. After the mounting succeeds, move or copy all subdirectories and files back.

mount /dev/mapper/sapvg-lvsapsid /usr/sap/T01

# df -Th
Filesystem                   Type      Size  Used Avail Use% Mounted on
devtmpfs                     devtmpfs  3.9G  8.0K  3.9G   1% /dev
tmpfs                        tmpfs     8.0G     0  8.0G   0% /dev/shm
tmpfs                        tmpfs     3.9G  660K  3.9G   1% /run
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/vda1                    ext4       40G  3.6G   34G  10% /
/dev/vdf                     ext4       40G   48M   38G   1% /sapcd
/dev/mapper/datavg-lvhdata   xfs        50G   33M   50G   1% /hana/data
/dev/mapper/datavg-lvhlog    xfs        10G   33M   10G   1% /hana/log
/dev/mapper/datavg-lvhshared xfs        20G   33M   20G   1% /hana/shared
/dev/mapper/sapvg-lvusrsap   xfs        60G   33M   60G   1% /usr/sap
tmpfs                        tmpfs     799M     0  799M   0% /run/user/0
/dev/mapper/sapvg-lvsapsid   xfs        20G   33M   20G   1% /usr/sap/T01

4. Add the file system configuration to the fstab file.

echo "/dev/mapper/sapvg-lvsapsid      /usr/sap/T01    xfs     defaults        0       0" >>/etc/fstab

Data disk resizing

View the file system type

To view information about the file system of the current ECS instance, you need to log on to the operating system of the instance.

The operating system is SUSE Linux Enterprise 12. The file system types of data disks include XFS and Ext4.

# df -Th
Filesystem                   Type      Size  Used Avail Use% Mounted on
devtmpfs                     devtmpfs  3.9G  8.0K  3.9G   1% /dev
tmpfs                        tmpfs     8.0G     0  8.0G   0% /dev/shm
tmpfs                        tmpfs     3.9G  624K  3.9G   1% /run
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/vda1                    ext4       40G  3.6G   34G  10% /
tmpfs                        tmpfs     799M     0  799M   0% /run/user/0
/dev/mapper/sapvg-lvusrsap   xfs        30G   33M   30G   1% /usr/sap
/dev/mapper/datavg-lvhdata   xfs        30G   33M   30G   1% /hana/data
/dev/mapper/datavg-lvhlog    xfs        10G   33M   10G   1% /hana/log
/dev/mapper/datavg-lvhshared xfs        20G   33M   20G   1% /hana/shared
/dev/vdf                     ext4       20G   44M   19G   1% /sapcd

Extend partitions

You can run the lsblk command to display information about all partitions in the ECS instance. For more information about LVM partitions, see LVM Howto.

The following command output indicates the disk status before resizing:

# lsblk
NAME               MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda                253:0    0  40G  0 disk 
└─vda1             253:1    0  40G  0 part /
vdb                253:16   0  20G  0 disk 
├─datavg-lvhshared 254:0    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:1    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:2    0  10G  0 lvm  /hana/log
vdc                253:32   0  20G  0 disk 
├─datavg-lvhshared 254:0    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:1    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:2    0  10G  0 lvm  /hana/log
vdd                253:48   0  20G  0 disk 
├─datavg-lvhshared 254:0    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:1    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:2    0  10G  0 lvm  /hana/log
vde                253:64   0  30G  0 disk 
└─sapvg-lvusrsap   254:3    0  30G  0 lvm  /usr/sap
vdf                253:80   0  20G  0 disk /sapcd

Log on to the ECS console. Select a disk and resize it. After resizing is completed, restart the ECS instance for the disk.

# lsblk
NAME               MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda                253:0    0  40G  0 disk 
└─vda1             253:1    0  40G  0 part /
vdb                253:16   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdc                253:32   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdd                253:48   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  30G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vde                253:64   0  60G  0 disk 
└─sapvg-lvusrsap   254:0    0  30G  0 lvm  /usr/sap
vdf                253:80   0  40G  0 disk /sapcd

Each of the /dev/vdb, /dev/vdc, and /dev/vdd disks has three partitions, namely, /hana/shared, /hana/data, and /hana/log. These partitions stripe data across the three disks. The space of each disk has been resized from 40 GB to 120 GB, but the logical volume space remains unchanged (30 GB). You need to resize the volume group, and then resize the logical volume.

The /dev/vde disk has only one logical volume, /usr/sap. The disk space has been resized to 60 GB, but the logical volume space remains unchanged (30 GB). You need to resize the volume group, and then resize the logical volume.

The /dev/vdf disk is not partitioned. The disk size after resizing equals to the partition size (40 GB).

Extend the volume group and logical volume

You can use LVM commands to resize file systems.

1. Extend physical volumes.

# pvresize /dev/vdb /dev/vdc /dev/vdd /dev/vde
  Physical volume "/dev/vdb" changed
  Physical volume "/dev/vdc" changed
  Physical volume "/dev/vdd" changed
  Physical volume "/dev/vde" changed
  4 physical volume(s) resized / 0 physical volume(s) not resized

2. Resize logical volumes as required. In this example, logical volumes are resized as follows:

# lvresize -L +20G /dev/datavg/lvhdata
  Using stripesize of last segment 64.00 KiB
  Rounding size (12800 extents) up to stripe boundary size for segment (12801 extents)
  Size of logical volume datavg/lvhdata changed from 30.00 GiB (7680 extents) to 50.00 GiB (12801 extents).
  Logical volume lvhdata successfully resized

# lvresize -L +30G /dev/sapvg/lvusrsap
  Size of logical volume sapvg/lvusrsap changed from 30.00 GiB (7679 extents) to 60.00 GiB (15359 extents).
  Logical volume lvusrsap successfully resized

3. Extend logical volumes.

Example: Resize XFS file systems.

# xfs_growfs /usr/sap
meta-data=/dev/mapper/sapvg-lvusrsap isize=256    agcount=4, agsize=1965824 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7863296, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=3839, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7863296 to 15727616

 # xfs_growfs /hana/data
meta-data=/dev/mapper/datavg-lvhdata isize=256    agcount=16, agsize=491504 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7864064, imaxpct=25
         =                       sunit=16     swidth=48 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=3840, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7864064 to 13108224

Example: Run the resize2fs command to resize Ext file systems (Ext2, Ext3, and Ext4) for each volume.

# resize2fs /dev/vdf
resize2fs 1.42.11 (09-Jul-2014)
Filesystem at /dev/vdf is mounted on /sapcd; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/vdf is now 10485760 blocks long.

4. Verify the resizing.

# df -Th
Filesystem                   Type      Size  Used Avail Use% Mounted on
devtmpfs                     devtmpfs  3.9G  8.0K  3.9G   1% /dev
tmpfs                        tmpfs     8.0G     0  8.0G   0% /dev/shm
tmpfs                        tmpfs     3.9G  648K  3.9G   1% /run
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/vda1                    ext4       40G  3.6G   34G  10% /
/dev/vdf                     ext4       40G   48M   38G   1% /sapcd
tmpfs                        tmpfs     799M     0  799M   0% /run/user/0
/dev/mapper/datavg-lvhdata   xfs        50G   33M   50G   1% /hana/data
/dev/mapper/datavg-lvhlog    xfs        10G   33M   10G   1% /hana/log
/dev/mapper/datavg-lvhshared xfs        20G   33M   20G   1% /hana/shared
/dev/mapper/sapvg-lvusrsap   xfs        60G   33M   60G   1% /usr/sap

# lsblk
NAME               MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda                253:0    0  40G  0 disk 
└─vda1             253:1    0  40G  0 part /
vdb                253:16   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdc                253:32   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vdd                253:48   0  40G  0 disk 
├─datavg-lvhshared 254:1    0  20G  0 lvm  /hana/shared
├─datavg-lvhdata   254:2    0  50G  0 lvm  /hana/data
└─datavg-lvhlog    254:3    0  10G  0 lvm  /hana/log
vde                253:64   0  60G  0 disk 
└─sapvg-lvusrsap   254:0    0  60G  0 lvm  /usr/sap
vdf                253:80   0  40G  0 disk /sapcd