Aliyun How to enlarge the data disk (Linux instance)

Source: Internet
Author: User

  Aliyun How to enlarge the data disk (Linux instance)

As your business grows, your disk capacity may not meet your data storage needs, and you can expand the disk.

The methods described in this document apply only to data disks . If you want to enlarge the system disk , you need to replace the system disk. Please refer to the replacement system disk.

Information on expansion

Before expansion

It is recommended that you manually create snapshots to back up your data before you enlarge the disk.

If you are performing an action to create a snapshot on disk, the expansion operation is not allowed at this time.

Only do disk capacity expansion, do not do file system expansion.

Supports the expansion of the normal disk, does not support the local disk (local disks, local SSD disk) expansion.

A data disk mounted on an instance that can be expanded only if the instance is in the running (Running ) or stopped (Stopped ) state.

After the expansion

After using the ECS console or the open API to expand the disk, you need to restart the instance with the ECS console or with the open API before it can take effect.

The disk after the expansion takes effect still requires the user to manually format the extended storage space.

Operation Steps

This document is an example of an Ubuntu 14.04 system that describes how to do disk expansion. Other Linux systems have similar operations.

In this example, the initial disk size selected is GB, and we expand it to GB.

Log on to the Cloud Server Management Console.

Click an instance in the left navigation. Then select the region at the top of the page.

First go to the Disk List page and click more > disk Expansion . Note This option is available only on the data disk . For system disks , the expansion is required by replacing the system disk.

After entering the expansion page, fill in the capacity after the expansion of the disk size, click to enlarge .

You can also use OPENAPI to enlarge the operation directly:

Resizedisk--diskid=d-94tomxanq--newsize=70

Reboot the server. Go to the Instance List page, click More , and choose Reboot.

Or use OPENAPI to restart the operation:

Rebootinstance--INSTANCEID=I-94LW423M7

Log on to an ECS instance.

If the disk was previously mount on the server, umount the disk first.

Umount/mnt/dev1

Delete the existing partition and create a new partition. If you have not previously partitioned, directly format the use, please skip to step 9th.

Some users use the parted tool to manipulate partitions, but parted and Fdisk cannot be interleaved, otherwise causing a partition's starting sector to be inconsistent. So when you delete an existing partition to build a new partition, follow these steps:

1. Use fdisk-l to list the partition information and record the final capacity and the starting sector position of the disk that will be enlarged.

2. Using the fdisk directive, enter D to delete the original partition.

3). Enter n ,p ,1 to create a new partition.

4. When selecting sector , the default value is selected directly in this example, and you can choose according to your own needs. To ensure data consistency, the first sector recommendation is consistent with previous partitions.

The following is an example of using Fdisk:

```

root@iz94lw423m7z:~# Fdisk/dev/xvdb

Command (M for help): D

Selected partition 1

Command (M for help): N

Partition Type:

P Primary (0 primary, 0 extended, 4 free)

E Extended

Select (default p): P

Partition number (1-4, default 1): 1

The sector (2048-146800639, default 2048):

Using Default Value 2048

Last sector, +sectors or +size{k,m,g} (2048-146800639, default 146800639):

Using Default Value 146800639

Command (M for help): Wq

The partition table has been altered!

Calling IOCTL () to re-read partition table.

Syncing disks.

```

If the first sector this discovery location is inconsistent with the previous record, indicating that the parted was previously used to partition, stop the current FDISK operation and use parted to do the operation again.

Using the parted directive, enter p to list the current partition, and if so, use the rm+ serial number to delete the old partition table, then use unit s to define the starting position units using the number of slices, and then use the Mkpart command to create it, as shown in the following figure.

Check the file system and change the file system size.

When using E2FSCK because the system needs to check and revise file system metadata, so slow and time-consuming, please wait patiently.

Using e2fsck and RESIZE2FS instructions, the correct operation of the case, will not cause the original data loss.

```

E2fsck-f/DEV/XVDB1

Resize2fs/dev/xvdb1

```

Mount the completed disk back to the original mount point.

```

Mount/dev/xvdb1/mnt/dev1

```

Use the DF-TH directive to view information about the disk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.