Help Center> SAP Cloud> SAP Deployment Guide (DeC)> Appendix> Follow-up Procedure After DESS Disk Capacity Expansion (fdisk)

Follow-up Procedure After DESS Disk Capacity Expansion (fdisk)

After the capacity expansion of a DESS disk has succeeded, the additional disk space needs to be allocated to an existing partition or a new partition of a BMS.

Prerequisites

  • You have logged in to the BMS. For details about how to log in to a BMS, see section Logging In to a BMS in the Bare Metal Server User Guide.
  • You have attached the disk to the BMS, and the additional disk space has not been allocated.

Background

This section uses SUSE Linux Enterprise Server 11 SP4 64bit to describe how to allocate the additional space of an attached SCSI data disk to a partition using fdisk.

Currently, a disk has been attached to the BMS, the original disk capacity is 10 GB. In addition, a 10-GB space has been added to the disk through the management console, and the total disk capacity should be 20 GB. However, the additional space cannot be viewed on the BMS. The following operations guide you to query the additional space and expand the partition.

The method for allocating the additional space varies depending on the BMS OS. This document is used for reference only. For detailed operations and differences, see the corresponding OS documents.

Based on your service requirements and actual disk condition, you can choose either of the following ways to allocate the additional disk space:
  • Create a new partition (services will not be interrupted).

    Creating a new partition for the expanded disk does not require the original partitions to be unmounted. Therefore, the impacts on services are minor than expanding an existing partition. This method is recommended for system disks or disks carrying services that cannot be interrupted.

    If the MBR partition style is used, the disk capacity cannot exceed 2 TB and the number of partitions cannot exceed the upper limit after the expansion completes.

  • Expand an existing partition (services will be interrupted).

    If the MBR partition style is used and the number of partitions has reached the upper limit, the existing partition needs to be expanded. Expanding an existing partition does not delete its data, but requires the partition to unmount. Therefore, the services will be interrupted.

    If the MRB partition style is used and the disk capacity after expansion has exceeded 2 TB, the disk space besides 2 TB cannot be allocated to a partition with MBR. In this case, if you change the partition style from MBR to GPT, the original disk data will be cleared. Therefore, back up the disk data before you change the partition style.

Expanding the Existing Partition

The following example shows you how to make use of the additional capacity of a disk attached to a BMS by recreating the /dev/sda1 partition and mounting the partition on /mnt/sdc. During this process, the services will be interrupted.

  1. Run the following command to view the disk partition information:

    fdisk -l

    Information similar to the following is displayed:
    ecs-xen-02:/home/linux # fdisk -l
    
    Disk /dev/xvda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x00065c40
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvda1            2048    41945087    20971520   82  Linux swap / Solaris
    /dev/xvda2   *    41945088    83892223    20973568   83  Linux
    /dev/xvda3        83892224   209715199    62911488   83  Linux
    
    Disk /dev/sda: 10.7 GB, 10737418240 bytes
    64 heads, 32 sectors/track, 10240 cylinders, total 20971520 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 identifier: 0x2f1c057a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048    20971519    10484736   83  Linux

    In the command output, the 10 GB has been added to the /dev/sda data disk on the management console, and the total capacity should be 20 GB. However, the additional space is not included in the command output. In this case, run the desired command to update the disk capacity of the BMS.

  2. Run the following command to update the disk capacity of the BMS:

    echo 1 > /sys/class/scsi_device/%d:%d:%d:%d/device/rescan &

    In the command, %d:%d:%d:%d indicates a folder in the /sys/class/scsi_device/ directory and can be obtained using lsscsi.

    For example, run the following command:

    echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan &

  3. After the update is complete, run the following command to view the disk partition information again:

    fdisk -l

    Information similar to the following is displayed:
    ecs-xen-02:/sys/class/scsi_device # fdisk -l
    
    Disk /dev/xvda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x00065c40
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvda1            2048    41945087    20971520   82  Linux swap / Solaris
    /dev/xvda2   *    41945088    83892223    20973568   83  Linux
    /dev/xvda3        83892224   209715199    62911488   83  Linux
    
    Disk /dev/sda: 21.5 GB, 21474836480 bytes
    64 heads, 32 sectors/track, 20480 cylinders, total 41943040 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 identifier: 0x2f1c057a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048    20971519    10484736   83  Linux

    In the command output, the additional space has been added to the /dev/sda data disk, and the update is successful. The /dev/sda disk has only one partition, /dev/sda1. Take note of first and last sectors of the /dev/sda1 partition. These values will be used during the partition recreation. The partition's first sector is 2048, and its last sector is 20971519.

  4. Run the following command to unmount the disk partition:

    umount /mnt/sdc

  5. Run the following command to enter fdisk and enter d to delete the /dev/sda1 partition:

    fdisk /dev/sda

    Information similar to the following is displayed:
    [ecs-xen-02:/sys/class/scsi_device # fdisk /dev/sda
    
    Command (m for help): d
    Selected partition 1
    
    Command (m for help): 

  6. Enter n and press Enter to create partitions.

    Entering n creates a new partition.

    Information similar to the following is displayed:
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    There are two types of disk partitions:
    • Choosing p creates a primary partition.
    • Choosing e creates an extended partition.

  7. Ensure that the entered partition type is the same as the partition had before. In this example, a primary partition is used. Therefore, enter p and press Enter to create a primary partition.

    Information similar to the following is displayed:
    p
    Partition number (1-4, default 1):

    In the command output, Partition number specifies the primary partition number.

  8. Ensure that entered partition number is the same as the partition had before. In this example, the partition number 1 is used. Therefore, enter 1 and press Enter.

    Information similar to the following is displayed:
    Partition number (1-4, default 1): 1
    First sector (2048-41943039, default 2048):

    In the command output, First sector specifies the first sector.

    Data will be lost if the following operations are performed:
    • Select a first sector other than the partition had before.
    • Select a last sector smaller than the partition had before.

  9. Ensure that the entered first sector is the same as the partition had before. In this example, first sector 2048 is recorded in 3. Therefore, enter 2048 and press Enter.

    Information similar to the following is displayed:
    First sector (2048-41943039, default 2048): 
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 

    In the command output, Last sector specifies the last sector.

  10. Ensure that the entered last sector is equal to or greater than the last sector recorded in 3. In this example, the recorded last sector is 20971519, and the default last sector is used. Therefore, enter 41943039 and press Enter.

    Information similar to the following is displayed:
    Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 
    Using default value 41943039
    
    Command (m for help):

    The primary partition is successfully created.

  11. Enter p and press Enter to view the details about the created partition.

    Information similar to the following is displayed: (Details about the /dev/sda1 partition are displayed.)
    CCommand (m for help): p
    
    Disk /dev/sda: 21.5 GB, 21474836480 bytes
    64 heads, 32 sectors/track, 20480 cylinders, total 41943040 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 identifier: 0x2f1c057a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048    41943039    20970496   83  Linux
    Command (m for help): 
    

  12. Enter w and press Enter to write the changes into the partition table.

    Information similar to the following is displayed. The partition is successfully created.
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

    In case that you want to discard the changes made before, you can exit fdisk by entering q.

  13. Run the following command to check the correctness of the file system on /dev/sda1:

    e2fsck -f /dev/sda1

    Information similar to the following is displayed:
    ecs-xen-02:/sys/class/scsi_device # e2fsck -f /dev/sda1
    e2fsck 1.41.9 (22-Aug-2009)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/sda1: 11/655360 files (0.0% non-contiguous), 79663/2621184 blocks

  14. Run the following command to expand the size of the file system on /dev/sda1:

    resize2fs /dev/sda1

    Information similar to the following is displayed:
    ecs-xen-02:/sys/class/scsi_device # resize2fs /dev/sda1
    resize2fs 1.41.9 (22-Aug-2009)
    Resizing the filesystem on /dev/sda1 to 5242624 (4k) blocks.
    The filesystem on /dev/sda1 is now 5242624 blocks long.

  15. Run the following command to mount the created partition to the /mnt/sdc directory:

    mount /dev/sda1 /mnt/sdc

  16. Run the following command to view the mount result for /dev/sda1:

    df -TH