CentOS7 LVM Dynamic Expansion

Source: Internet
Author: User
Tags hex code

CentOS7, new disk, will/home dynamic expansion.

[Root@localhost ~]# df-h filesystem           Size  Used avail use% mounted On/dev/ma pper/cl-root   50G  2.4g   48G   5%/devtmpfs          &NBSP ;   15g     0   15G   0%/dev tmpfs                 15G     0   15G   0%/dev/shm tmpfs          &NBS P      15G  8.5m   15G   1%/run tmpfs            &NBS P    15G     0   15G   0%/sys/fs/cgroup/dev/sda1           1014M  145m  870m  15%/boot/dev/mapper/cl-home   42G   33M   42G   1%/home tmpfs                3.0g     0&NBSP ; 3.0g   0%/run/user/0 [root@localhost ~]# fdisk-l [root@localhost ~]# df-h filesystem           SIZE&N Bsp  Used Avail use% mounted on/dev/mapper/cl-root   50G  2.4g   48G   5%/devtmpfs               15g     0   15G   0%/dev tmpfs                 15G     0   15G   0%/dev/shm tmpfs&nb Sp                15G  8.5m   15G   1%/run tmpfs  &nbs P              15G     0   15G   0%/sys/fs/cgroup/de v/sda1           1014M  145m  870m  15%/boot/dev/mapper/cl-home  &nbs p;42g   33M   42G   1%/home tmpfs                3. 0g     0  3.0g   0%/run/user/0 [root@localhost ~] #Disk/dev/sda:536.9 GB, 536870912000 bytes, 1048576000 s Ectors Units = sectors of 1 * The bytes sector size (logical/physical): bytes/512 bytes I/o size (minimum/opti Mal): bytes/512 bytes disk label type:dos disk identifier:0x000962a3 Device Boot Start End B Locks Id system/dev/sda1 * 2048 2099199 1048576 2099200 209715199 1 03808000 8e Linux LVM disk/dev/mapper/cl-root:53.7 GB, 53687091200 bytes, 104857600 sectors Units = sectors of 1 * 5 Bytes sector size (logical/physical): bytes/512 bytes I/o size (minimum/optimal): bytes/512 bytes D isk/dev/mapper/cl-swap:7918 MB, 7918845952 bytes, 15466496 sectors Units = sectors of 1 * The bytes = sector size (l  ogical/physical): bytes/512 bytes I/o size (minimum/optimal): bytes/512 bytes GB, 44686114816 bytes, 87277568 sectors Units = sectors of 1 * The bytes of sector size (logical/physical): bytes/512 bytes I/o size (

Minimum/optimal): bytes/512 bytes [root@localhost ~]# FDISK/DEV/SDA to fdisk (Welcome util-linux).
Changes'll remain in memory only, until you decide to write them.


Be careful before using the Write command. Command (M for help): P disk/dev/sda:536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * 512 = 512 Bytes sector size (logical/physical): bytes/512 bytes I/o size (minimum/optimal): bytes/512 bytes Disk label t        Ype:dos Disk identifier:0x000962a3 Device Boot Start End Blocks Id system/dev/sda1 *  2048 2099199 1048576 linux/dev/sda2 2099200 209715199 103808000 8e Linux LVM Command (M for Help): N Partition type:p Primary (2 primary, 0 extended, 2 free) e extended Select (default p): P Partition N Umber (3,4, default 3): 3-sector(209715200-1048575999, default 209715200): Using default value 209715200 last sector, +sectors or +size{k,m,g} (209715200 -1048575999, default 1048575999): Using default Value 1048575999 Partition 3 of type Linux and of size GiB is set Co  Mmand (M for help): T Partition number (1-3, default 3): 3 Hex code (type L to list all codes): L 0 Empty 24 NEC DOS bayi minix/old Lin BF Solaris 1 FAT12 Hidden NTFS Win-up Linux swap/so C1 D Rdos/sec (FAT-2 xenix root Plan 9 Linux c4 drdos/sec (FAT-3 xenix usr 3c Par Titionmagic os/2 Hidden c:c6 drdos/sec (FAT-4 FAT16 <32m} Venix 80286 Linux extended C7 Sy             Rinx 5 Extended PPC PReP Boot NTFS volume set da non-fs data 6 FAT16-SFS
 NTFS Volume Set DB cp/m/CTOs/.       7 Hpfs/ntfs/exfat 4d qnx4.x Linux plaintext de Dell Utility 8 AIX      4e qnx4.x 2nd part 8e Linux LVM DF bootit 9 AIX Bootable 4f qnx4.x 3rd part Amoeba       E1 DOS access a OS/2 Boot manag ontrack DM Amoeba BBT e3 DOS r/o b W95 FAT32 Wuyi Ontrack DM6 Aux 9f bsd/os e4 speedstor C W95 FAT32 (LBA) cp/m A0 IBM Thinkpad hi   EB BeOS FS E W95 FAT16 (LBA) Ontrack DM6 Aux a5 FreeBSD ee GPT f W95 Ext ' d (LBA) 54  OnTrackDM6 a6 OpenBSD ef (FAT-12/16/10 OPUS Linux/pa-risc b Hidden FAT12 Golden Bow A8 Darwin UFS F1 speedstor Compaq 5c Pr iam edisk A9 NetBSD f4 speedstor Hidden FAT16 <3 * SpeedStor ab Darwin boot F2 D OS secondary Hidden FAT16 the GNU HURD or Sys af hfs/hfs+ fb VMware VMFS Hidden hpfs/ntf Ell Netware B7 BSDI FS         FC VMware Vmkcore/AST smartsleep Novell Netware b8 bsdi swap fd Linux RAID Auto 1b Hidden W9 5 FAT3 disksecure mult bb Boot Wizard hid FE lanstep 1c Hidden W95 FAT3 pc/ix be Solaris Boo T ff BBT 1e Hidden W95 FAT1 old Minix Hex code (type L to list all codes): 8e Changed type of P
Artition ' Linux ' to ' Linux LVM ' Command (M for help): P disk/dev/sda:536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * The bytes sector size (logical/physical): bytes/512 bytes I/o size (minimum/optimal): 5   bytes/512 bytes Disk label type:dos disk identifier:0x000962a3 Device Boot Start End Blocks Id system/dev/sda1 * 2048 2099199 1048576 linux/dev/sda2 2099200 209715199 10380800  0 8e linux Lvm/dev/sda3 209715200 1048575999 419430400 8e linux LVM Command (M for help): W the partition Table has been altered!

Calling IOCTL () to re-read partition table.
Warning:re-reading the partition table failed with error 16:device or resource busy. The kernel still uses the old table.
The new table is used at the next reboot or after you run Partprobe (8) or KPARTX (8) Syncing disks.  [Root@localhost ~]#

Reboot the server

[Root@localhost ~]# reboot

Format the Division

[Root@localhost ~]# mkfs-t Xfs/dev/sda3
If the file system is being prompted, the-F parameter is forced to format
[Root@localhost ~]# mkfs-t xfs-f/dev/sda3

Expansion of new partitions

[Root@localhost ~]# pvcreate/dev/sda3        //Create Physical volume ' Physical volume '/dev
/sda3 "successfully created. [Root@localhost ~]# vgextend cl/dev/sda3        //Add physical volumes to the volume group Volume Group "CL" Successfully extended [root@localhost ~]# lvextend-l +100%free/dev/mapper/cl-home Size of Logical Volume Cl/home Chang
  Ed from 41.62 GiB (10654 extents) to 441.62 GiB (113054 extents).
Logical volume Cl/home successfully resized. [Root@localhost ~]# Cat/etc/fstab #/etc/fstab # Created by Anaconda on Thu Feb # 04:20:19 2017 # # Accessible Filesy Stems, by reference, are maintained under '/dev/disk ' # The man pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for MO Re info #/DEV/MAPPER/CL-ROOT/XFS defaults 0 0 uuid=dbde1d57-dfb5-475a-8018-de46053         Bb8b4/boot xfs defaults 0 0/dev/mapper/cl-home/home xfs Defaults0 0/dev/mapper/cl-swap Swap defaults 0 0 [root@localhost ~]# xfs_growfs/dev/mapper /cl-home meta-data=/dev/mapper/cl-home isize=512 agcount=4, agsize=2727424 blks = sec                       tsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=10909696, imaxpct=25 = sunit=0 swidth=0 blks naming-=ve
         Rsion 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=5327, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 Cks=0, rtextents=0 data blocks changed from 10909696 to 115767296 [root@localhost ~]# df-h filesystem Size Use                  D Avail use% mounted on/dev/mapper/cl-root 50G 2.4G 48G 5%/devtmpfs 15G 0 15G 0%/dev Tmpfs    15G 0 15G 0%/dev/shm tmpfs 15G 8.5M 15G 1%/run tmpfs 15G 0 15G 0%/sys/fs/                CGROUP/DEV/SDA1 1014M 145M 870M 15%/boot/dev/mapper/cl-home 442G 34M 442G 1%/home TMPFS  3.0G 0 3.0G 0%/run/user/0 [root@localhost ~]#
/home dynamic expansion completed.

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.