Adolph
Engineer
Engineer
  • UID623
  • Fans4
  • Follows1
  • Posts72
Reads:47733Replies:1

[Share][Solutions]A newbie shares his disk resizing experience: CentOS 6.5 32-bit system

Created#
More Posted time:Jul 8, 2016 15:04 PM
[Solutions]A newbie shares his disk resizing experience: CentOS 6.5 32-bit system
I use CentOS 6.5 (32-bit) and data disk is mounted under /mnt/, so the approach to resize a disk is slightly different fromwhat is described by Alibaba Cloud. Next, I am going to document the process as below for future reference. I am new to Linux, so please bear with me if you are an expert

I have written this article on my WordPress blog. Now I just needed to copy it from there. Below is the disk resizing process:

Create a snapshot (this makes it easy to recover in case ofany problems), and then resize the disk at back end.

1. Go to the ECS console
2. Select all disk pages or the disk page for this instance
3. Select "More" at the end of each disk entry
4. Select "Disk Resizing" to go to the disk resizing operation page
5. Enter the size you desire (40 GB in this case)
6. Submit the resizing order. For pay-as-you-go disks, billing will be based on the resized disk from the next billing period (currently by the hour). For subscription-based disks, the difference is added to the subscription price

Resizing only applies to the disk capacity, not to partitions and the file system. After resizing, you need to allocate the storage space manually.

For a newbie, the most difficult part lies exactly in the steps after disk resizing:


1. Rebootthe server

2.umount /dev/xvdb1
The error message says "Device is busy and the file is in use." I thought this was probably because the website was still running, so I stopped MySQL with "service mysqld stop" and ran "umount /dev/xvdb1" again. The problem was resolved.

3. Run "fdisk -l" and check disk serial number "/dev/xvdb1"

4. Delete the original partitions and create new partitions
(I entered an extra "1"at the end so it became "xvdb1", and the error message says "Re-reading the partition table failed with error 22:")
Use the "fdisk" command and enter "d" to delete the original partitions. Then, successively input "n", "p", and "1" (number) to create new partitions. When "sector" is selected, press Enter to select the default values. You can also make a selection based on your own needs. For data consistency, First sector should be consistent with the original partition settings.
    fdisk /dev/xvdb
    d
    n
    p
    1
Press Enter two times to show Command (m for help)

5.Enter "wq"
It prompts: The partition table has been altered!
                  Calling ioctl() to re-read partition table.
                  Syncing disks.

This means the operation is successful!

6. Format the disk
Use the "resize2fs" command to expand the size of the file system, so that existing data will not be lost.
e2fsck -f /dev/xvdb1
resize2fs /dev/xvdb1

7. Mount the disk
Finally, mount the resized disk to its original mount point
mount /dev/xvdb1 /mnt/
("/mnt/" is my original mount point)

8. Using the "df -h" command, you can view the disk information
df -h

To be on the safe side, please reboot the system to check if everything works.

Blanche
Engineer
Engineer
  • UID619
  • Fans3
  • Follows2
  • Posts59
1st Reply#
Posted time:Jul 11, 2016 15:12 PM
Is it possible to provide some screenshots for steps?  It is hard to find items since I am new for Linux...
Guest