Use lvm to support extended partitions and use lvm to expand partitions

Source: Internet
Author: User

Use lvm to support extended partitions and use lvm to expand partitions

Background:

As a Database Engineer, you must be very cautious about database operation settings. due to negligence, potential risks are immeasurable !!!

The following is a small detail about how to store datadir:

In order to use lvm to support the expansion due to insufficient database space in the future:
Separate mysql database datadir into one partition:
1. Create a separate Partition
Use less than 2 TB: for example, fdisk/dev/sdb
Restart OS
Create:
Pvcreate/dev/sdb1 ---> physical volume
Vgcreate volume group name (obtained by yourself) physical volume name (similar to/dev/sdb1)
Lvcreate-L size-n logical volume name (obtained by yourself) volume group name
Format:
Mkfs. ext4 "LV Path" (lvdisplay can be queried)
Mount the file system:
Mount "LV Path" mount point
Note: add the created File System to/etc/fstab.

 


2. Create the datadir directory under the above mount point

When datadir times out and the partition space of the mount point in the directory is insufficient, scale up:
1. vgextend volume group name/dev/sdb1
2. lvextend-L + size logical volume name/dev/sdb1 ---> increase logical volume
Or:
Lvextend logical volume name/dev/sdb1
3. e2fsck-f logical volume name ---> check the partition to be adjusted
Resize2fs logical volume name ---> increase the File System
4. mount Points
5. df-h ---> check whether the partition is increased.

To increase the logical volume, first increase the logical volume and then increase the file system with resize2fs.

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.