Extended root partitions: Introduction to the usage of each partition and introduction to extended root partitions

Source: Internet
Author: User

Extended root partitions: Introduction to the usage of each partition and introduction to extended root partitions

List the usage of each partition:

# Df-ThFilesystem Type Size Used Avail Use % Mounted on/dev/mapper/centos-root xfs 997 M 994 M 2.9 M 100%/devtmpfs 915 M 0 915 M 0%/devtmpfs tmpfs 921 M 0 921 M 0%/dev/shmtmpfs tmpfs 921 M 17 M 905 M 2%/runtmpfs tmpfs 921 M 0 921 M 0%/sys/fs/cgroup/dev/mapper/centos- usr xfs 4.9G 1.6G 3.4G 33%/usr/dev/sda1 xfs 97 M 66 M 31 M 69%/boot/dev/mapper/centos-var xfs 2.4G 473 M 1.9G 21%/var:/dev/mapper /Centos-root has used 100%. We are going to resize it. Add a new virtual disk to VirtualBox: Disable the operating system first. Select the current VM in VirtualBox, set-> storage-> controller-> SATA controller, and click the icon "add virtual hard disk" to create a new virtual hard disk. I added a virtual disk of 3GiB size, saved it, and started the virtual machine again. To create a new partition, first check the existing Disk: # fdisk-l result: Disk/dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk label type: dosDisk identifier: 0x000940ec Device Boot Start End Blocks Id System/dev/sda1 * 2048 206847 102400 83 Linux/dev/sda2 206848 41943039 20868096 8e Linux LVMD Isk/dev/sdb: 3221 MB, 3221225472 bytes, 6291456 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk/dev/mapper/centos-swap: 2097 MB, 2097152000 bytes, 4096000 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/5 12 bytesDisk/dev/mapper/centos-usr: 5242 MB, 5242880000 bytes, 10240000 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk/dev/mapper/centos-root: 1048 MB, 1048576000 bytes, 2048000 sectorsUnits = sectors of 1*512 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum /Optimal): 512 bytes/512 bytes... you can see the new disk/dev/sdb. Partition the new disk: # fdisk/dev/sdb in the interactive mode of fdisk, and enter: n -- create new partition p -- create primary partition <press enter> -- default Partition Number <press enter> -- default start sector position. <Press enter> -- default end sector position. W -- write the partition table to split the entire disk into one partition. Let's take a look at the current disk situation: # fdisk-l has a new partition: device Boot Start End Blocks Id System/dev/sdb1 2048 6291455 3144704 83 Linux uses the new partition for extension/root to view the next volume group first: # vgdisplay-vFinding all volume groups Finding volume group "centos" --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 5 Open LV 5 Max PV 0 Cur PV 1 Act PV 1 VG Siz E 19.90 GiB PE Size 4.00 MiB Total PE 5094 Alloc PE/Size 5093/19 .89 GiB Free PE/Size 1/4.00 MiB vg uuid vtJL08-7Jxi-5IqK-3fUg-Pben-682a-wiv2GL --- Logical volume --- LV Path/dev/centos/root LV Name root VG Name centos lv uuid ZWTgoT-AMWs-g54v-dZA1-NQUj-mqGa-8tmr4U LV Write Access read/write LV Creation host, time localhost, 21:59:31-0400 LV Status available # open 1 LV Size 10 00.00 MiB Current LE 250 Segments 1 Allocation inherit Read ahead sectors auto currently set to 256 Block device 253: 2 ......... --- Physical volumes --- PV Name/dev/sda2 pv uuid fiVH1e-lwfi-63Lr-oIlK-GDZI-dcuZ-T04VlC PV Status allocatable Total PE/Free PE 5094/1 You can see the current volume group Name "centos ". Create a physical volume for the newly added partition: # pvcreate/dev/sdb1 indicates whether to erase the xfs signature. I selected y: WARNING: xfs signature detected on/dev/sdb1 at offset 0. wipe it? [Y/n] y Wiping xfs signature on/dev/sdb1. Physical volume "/dev/sdb1" successfully created view result: # pvdisplay displays the newly created Physical volume of 3GiB size: --- Physical volume --- PV Name/dev/sda2 VG Name centos PV Size 19.90 GiB/not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 5094 Free PE 1 Allocated PE 5093 pv uuid fiVH1e-lwfi-63Lr-oIlK-GDZI-dcuZ-T04VlC "/dev/sdb1" is a new physical volume of "3.00 GiB "--- NEW Physical volume --- PV Name/dev/sdb1 VG Name PV Size 3.00 GiB Allocatable no pe Size 0 Total PE 0 Free PE 0 Allocated PE 0 pv uuid VGXSAn-UiZ0-Fy40-eQxb-53xA-5hZM-3eGPg0 expansion volume group, "centos" is the volume group name found by the vgdisplay command: # vgextend centos/dev/sdb1 indicates that the extension is successful. Check the logical volume below: # lvdisplay shows that the current LV Size of/dev/centos/root is 1000MiB. The following extended logical volume/dev/centos/root: # lvextend-L + 3G/dev/centos/root note: + 3G is the size of our new partition. After expansion, perform the following steps: # xfs_growfs/dev/centos/root to expand the file system. Complete. Because the xfs partition used to install CentOS is used, the xfs_growfs command is used to expand the file system size. Otherwise, use the resize2fs command. View the result: # df-Th/root has been expanded to 4GiB: filesystem Type Size Used Avail Use % Mounted on/dev/mapper/centos-root xfs 4.0G 995 M 3.1G 25%/devtmpfs 915 M 0 915 M 0%/devtmpfs tmpfs 921 M 0 921 M 0%/dev/shmtmpfs tmpfs 921 M 8.4 M 913 M 1%/runtmpfs tmpfs 921 M 0 921 M 0%/sys/fs/cgroup/dev/mapper/centos-usr xfs 4.9G 1.6G 3.4G 33%/usr/dev/mapper/centos-home xfs 9.8G 391 M 9.4G 4%/home/dev/mapper/centos-var xfs 2.4G 469 M 1.9G 20%/var/dev/sda1 xfs 97 M 66 M 31 M 69%/boot

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.