日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos7根目录root扩容操作记录

發布時間:2025/3/15 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7根目录root扩容操作记录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、首先確認當前各文件系統大小,可以看到根目錄對應文件系統大小是10GB,/boot對應文件系統大小是0.4GB。

[root@backup03?~]# df -h Filesystem ? ? ? ? ? ? ? Size ?Used Avail Use% Mounted on /dev/mapper/centos-root ? 10G ?9.5G ?588M ?95% / devtmpfs ? ? ? ? ? ? ? ? 471M ? ? 0 ?471M ? 0% /dev tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /dev/shm tmpfs ? ? ? ? ? ? ? ? ? ?488M ?8.6M ?479M ? 2% /run tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /sys/fs/cgroup /dev/sda1 ? ? ? ? ? ? ? ?197M ?135M ? 62M ?69% /boot tmpfs ? ? ? ? ? ? ? ? ? ? 98M ?4.0K ? 98M ? 1% /run/user/42 tmpfs ? ? ? ? ? ? ? ? ? ? 98M ? 40K ? 98M ? 1% /run/user/1000 /dev/sr0 ? ? ? ? ? ? ? ? 4.2G ?4.2G ? ? 0 100% /run/media/admin/CentOS 7 x86_64 tmpfs ? ? ? ? ? ? ? ? ? ? 98M ? ? 0 ? 98M ? 0% /run/user/0 [root@backup03?~]# vgdisplay--- Volume group ---VG Name ? ? ? ? ? ? ? centosSystem ID ? ? ? ? ? ??Format ? ? ? ? ? ? ? ?lvm2Metadata Areas ? ? ? ?1Metadata Sequence No ?3VG Access ? ? ? ? ? ? read/writeVG Status ? ? ? ? ? ? resizableMAX LV ? ? ? ? ? ? ? ?0Cur LV ? ? ? ? ? ? ? ?2Open LV ? ? ? ? ? ? ? 2Max PV ? ? ? ? ? ? ? ?0Cur PV ? ? ? ? ? ? ? ?1Act PV ? ? ? ? ? ? ? ?1VG Size ? ? ? ? ? ? ? 12.00 GiBPE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?3073Alloc PE / Size ? ? ? 3072 / 12.00 GiBFree ?PE / Size ? ? ? 1 / 4.00 MiBVG UUID ? ? ? ? ? ? ? Qed7Il-G05u-VJwf-Z8M4-3UWK-N5Q1-Cd5UNm[root@backup03?~]# vgdisplay -v centos--- Volume group ---VG Name ? ? ? ? ? ? ? centosSystem ID ? ? ? ? ? ??Format ? ? ? ? ? ? ? ?lvm2Metadata Areas ? ? ? ?1Metadata Sequence No ?3VG Access ? ? ? ? ? ? read/writeVG Status ? ? ? ? ? ? resizableMAX LV ? ? ? ? ? ? ? ?0Cur LV ? ? ? ? ? ? ? ?2Open LV ? ? ? ? ? ? ? 2Max PV ? ? ? ? ? ? ? ?0Cur PV ? ? ? ? ? ? ? ?1Act PV ? ? ? ? ? ? ? ?1VG Size ? ? ? ? ? ? ? 12.00 GiBPE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?3073Alloc PE / Size ? ? ? 3072 / 12.00 GiBFree ?PE / Size ? ? ? 1 / 4.00 MiBVG UUID ? ? ? ? ? ? ? Qed7Il-G05u-VJwf-Z8M4-3UWK-N5Q1-Cd5UNm--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/swapLV Name ? ? ? ? ? ? ? ?swapVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?NjK7gM-hymI-WqnN-1voq-zSfx-9XCC-Jae1AQLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 2LV Size ? ? ? ? ? ? ? ?2.00 GiBCurrent LE ? ? ? ? ? ? 512Segments ? ? ? ? ? ? ? 1Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:1--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/rootLV Name ? ? ? ? ? ? ? ?rootVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?e4bOKq-cwBJ-J6Xr-NwpX-ISA8-WWAz-TfYXLRLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 1LV Size ? ? ? ? ? ? ? ?10.00 GiBCurrent LE ? ? ? ? ? ? 2560Segments ? ? ? ? ? ? ? 1Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:0--- Physical volumes ---PV Name ? ? ? ? ? ? ? /dev/sda2 ? ??PV UUID ? ? ? ? ? ? ? vuDSnI-BoRc-JICJ-SJ0l-1jAE-PSbu-OfS0U8PV Status ? ? ? ? ? ? allocatableTotal PE / Free PE ? ?3073 / 1[root@backup03?~]#?


?

2、確認當前磁盤容量信息,/dev/sda大小為53.7GB,劃分了2個分區,已劃分的總容量不到20GB。還有將近30GB可用空間

[root@backup03?~]# fdisk -lDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000bc6acDevice Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System /dev/sda1 ? * ? ? ? ?2048 ? ? ?411647 ? ? ?204800 ? 83 ?Linux /dev/sda2 ? ? ? ? ?411648 ? ?25593855 ? ?12591104 ? 8e ?Linux LVMDisk /dev/mapper/centos-root: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes[root@backup03?~]#?

3、在未用空間創建新的分區sda3。

[root@backup03 ~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them. Be careful before using the write command.Command (m for help): m Command actiona ? toggle a bootable flagb ? edit bsd disklabelc ? toggle the dos compatibility flagd ? delete a partitiong ? create a new empty GPT partition tableG ? create an IRIX (SGI) partition tablel ? list known partition typesm ? print this menun ? add a new partitiono ? create a new empty DOS partition tablep ? print the partition tableq ? quit without saving changess ? create a new empty Sun disklabelt ? change a partition's system idu ? change display/entry unitsv ? verify the partition tablew ? write table to disk and exitx ? extra functionality (experts only)Command (m for help): n Partition type:p ? primary (2 primary, 0 extended, 2 free)e ? extended Select (default p): p Partition number (3,4, default 3):? First sector (25593856-104857599, default 25593856):? Using default value 25593856 Last sector, +sectors or +size{K,M,G} (25593856-104857599, default 104857599):? Using default value 104857599 Partition 3 of type Linux and of size 37.8 GiB is setCommand (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 will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.

?

4、根據上面步驟的提示,需要重啟或者運行命令partprobe重新同步磁盤分區信息,分區重新識別后可以看到新分區sda3。?

[root@backup03 ~]# partprobe Warning: Unable to open /dev/sr0 read-write (Read-only file system). ?/dev/sr0 has been opened read-only.查看磁盤信息? fdisk -l?[root@backup03 ~]# fdisk -lDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000bc6acDevice Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System /dev/sda1 ? * ? ? ? ?2048 ? ? ?411647 ? ? ?204800 ? 83 ?Linux /dev/sda2 ? ? ? ? ?411648 ? ?25593855 ? ?12591104 ? 8e ?Linux LVM /dev/sda3 ? ? ? ?25593856 ? 104857599 ? ?39631872 ? 83 ?LinuxDisk /dev/mapper/centos-root: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

5、使用lvm命令pvcreate格式化sda3分區。

[root@backup03 ~]# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created.5.1查看磁盤分區情況[root@backup03 ~]# fdisk -lDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000bc6acDevice Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System /dev/sda1 ? * ? ? ? ?2048 ? ? ?411647 ? ? ?204800 ? 83 ?Linux /dev/sda2 ? ? ? ? ?411648 ? ?25593855 ? ?12591104 ? 8e ?Linux LVM /dev/sda3 ? ? ? ?25593856 ? 104857599 ? ?39631872 ? 83 ?LinuxDisk /dev/mapper/centos-root: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes[root@backup03 ~]# pvdisplay--- Physical volume ---PV Name ? ? ? ? ? ? ? /dev/sda2VG Name ? ? ? ? ? ? ? centosPV Size ? ? ? ? ? ? ? <12.01 GiB / not usable 4.00 MiBAllocatable ? ? ? ? ? yes?PE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?3073Free PE ? ? ? ? ? ? ? 1Allocated PE ? ? ? ? ?3072PV UUID ? ? ? ? ? ? ? vuDSnI-BoRc-JICJ-SJ0l-1jAE-PSbu-OfS0U8"/dev/sda3" is a new physical volume of "<37.80 GiB"--- NEW Physical volume ---PV Name ? ? ? ? ? ? ? /dev/sda3VG Name ? ? ? ? ? ? ??PV Size ? ? ? ? ? ? ? <37.80 GiBAllocatable ? ? ? ? ? NOPE Size ? ? ? ? ? ? ? 0 ??Total PE ? ? ? ? ? ? ?0Free PE ? ? ? ? ? ? ? 0Allocated PE ? ? ? ? ?0PV UUID ? ? ? ? ? ? ? S2kmTF-YDWR-CzTt-7Krv-wUWk-elwu-xwQdBf

6、將分區sda3加入root所在的vg(centos)里? 。? ?

[root@backup03 ~]# vgextend centos /dev/sda3Volume group "centos" successfully extended [root@backup03 ~]# vgdisplay -v centos--- Volume group ---VG Name ? ? ? ? ? ? ? centosSystem ID ? ? ? ? ? ??Format ? ? ? ? ? ? ? ?lvm2Metadata Areas ? ? ? ?2Metadata Sequence No ?4VG Access ? ? ? ? ? ? read/writeVG Status ? ? ? ? ? ? resizableMAX LV ? ? ? ? ? ? ? ?0Cur LV ? ? ? ? ? ? ? ?2Open LV ? ? ? ? ? ? ? 2Max PV ? ? ? ? ? ? ? ?0Cur PV ? ? ? ? ? ? ? ?2Act PV ? ? ? ? ? ? ? ?2VG Size ? ? ? ? ? ? ? <49.80 GiBPE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?12748Alloc PE / Size ? ? ? 3072 / 12.00 GiBFree ?PE / Size ? ? ? 9676 / <37.80 GiBVG UUID ? ? ? ? ? ? ? Qed7Il-G05u-VJwf-Z8M4-3UWK-N5Q1-Cd5UNm--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/swapLV Name ? ? ? ? ? ? ? ?swapVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?NjK7gM-hymI-WqnN-1voq-zSfx-9XCC-Jae1AQLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 2LV Size ? ? ? ? ? ? ? ?2.00 GiBCurrent LE ? ? ? ? ? ? 512Segments ? ? ? ? ? ? ? 1Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:1--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/rootLV Name ? ? ? ? ? ? ? ?rootVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?e4bOKq-cwBJ-J6Xr-NwpX-ISA8-WWAz-TfYXLRLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 1LV Size ? ? ? ? ? ? ? ?10.00 GiBCurrent LE ? ? ? ? ? ? 2560Segments ? ? ? ? ? ? ? 1Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:0--- Physical volumes ---PV Name ? ? ? ? ? ? ? /dev/sda2 ? ??PV UUID ? ? ? ? ? ? ? vuDSnI-BoRc-JICJ-SJ0l-1jAE-PSbu-OfS0U8PV Status ? ? ? ? ? ? allocatableTotal PE / Free PE ? ?3073 / 1PV Name ? ? ? ? ? ? ? /dev/sda3 ? ??PV UUID ? ? ? ? ? ? ? S2kmTF-YDWR-CzTt-7Krv-wUWk-elwu-xwQdBfPV Status ? ? ? ? ? ? allocatableTotal PE / Free PE ? ?9675 / 9675

7、擴展root根分區所在的邏輯卷大小,vgdisplay可以看到root所在lv大小已經發生變化。
?

[root@backup03 ~]# lvextend -L +37.8G /dev/centos/rootRounding size to boundary between physical extents: 37.80 GiB.Insufficient free space: 9677 extents needed, but only 9676 available [root@backup03 ~]# lvextend -L +30G /dev/centos/rootSize of logical volume centos/root changed from 10.00 GiB (2560 extents) to 40.00 GiB (10240 extents).Logical volume centos/root successfully resized. [root@backup03 ~]# vgdisplay--- Volume group ---VG Name ? ? ? ? ? ? ? centosSystem ID ? ? ? ? ? ??Format ? ? ? ? ? ? ? ?lvm2Metadata Areas ? ? ? ?2Metadata Sequence No ?5VG Access ? ? ? ? ? ? read/writeVG Status ? ? ? ? ? ? resizableMAX LV ? ? ? ? ? ? ? ?0Cur LV ? ? ? ? ? ? ? ?2Open LV ? ? ? ? ? ? ? 2Max PV ? ? ? ? ? ? ? ?0Cur PV ? ? ? ? ? ? ? ?2Act PV ? ? ? ? ? ? ? ?2VG Size ? ? ? ? ? ? ? <49.80 GiBPE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?12748Alloc PE / Size ? ? ? 10752 / 42.00 GiBFree ?PE / Size ? ? ? 1996 / <7.80 GiBVG UUID ? ? ? ? ? ? ? Qed7Il-G05u-VJwf-Z8M4-3UWK-N5Q1-Cd5UNm[root@backup03 ~]#?[root@backup03 ~]# ?vgdisplay -v--- Volume group ---VG Name ? ? ? ? ? ? ? centosSystem ID ? ? ? ? ? ??Format ? ? ? ? ? ? ? ?lvm2Metadata Areas ? ? ? ?2Metadata Sequence No ?5VG Access ? ? ? ? ? ? read/writeVG Status ? ? ? ? ? ? resizableMAX LV ? ? ? ? ? ? ? ?0Cur LV ? ? ? ? ? ? ? ?2Open LV ? ? ? ? ? ? ? 2Max PV ? ? ? ? ? ? ? ?0Cur PV ? ? ? ? ? ? ? ?2Act PV ? ? ? ? ? ? ? ?2VG Size ? ? ? ? ? ? ? <49.80 GiBPE Size ? ? ? ? ? ? ? 4.00 MiBTotal PE ? ? ? ? ? ? ?12748Alloc PE / Size ? ? ? 10752 / 42.00 GiBFree ?PE / Size ? ? ? 1996 / <7.80 GiBVG UUID ? ? ? ? ? ? ? Qed7Il-G05u-VJwf-Z8M4-3UWK-N5Q1-Cd5UNm--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/swapLV Name ? ? ? ? ? ? ? ?swapVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?NjK7gM-hymI-WqnN-1voq-zSfx-9XCC-Jae1AQLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 2LV Size ? ? ? ? ? ? ? ?2.00 GiBCurrent LE ? ? ? ? ? ? 512Segments ? ? ? ? ? ? ? 1Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:1--- Logical volume ---LV Path ? ? ? ? ? ? ? ?/dev/centos/rootLV Name ? ? ? ? ? ? ? ?rootVG Name ? ? ? ? ? ? ? ?centosLV UUID ? ? ? ? ? ? ? ?e4bOKq-cwBJ-J6Xr-NwpX-ISA8-WWAz-TfYXLRLV Write Access ? ? ? ?read/writeLV Creation host, time www.ywl.com, 2019-05-04 18:03:38 +0800LV Status ? ? ? ? ? ? ?available# open ? ? ? ? ? ? ? ? 1LV Size ? ? ? ? ? ? ? ?40.00 GiBCurrent LE ? ? ? ? ? ? 10240Segments ? ? ? ? ? ? ? 2Allocation ? ? ? ? ? ? inheritRead ahead sectors ? ? auto- currently set to ? ? 8192Block device ? ? ? ? ? 253:0--- Physical volumes ---PV Name ? ? ? ? ? ? ? /dev/sda2 ? ??PV UUID ? ? ? ? ? ? ? vuDSnI-BoRc-JICJ-SJ0l-1jAE-PSbu-OfS0U8PV Status ? ? ? ? ? ? allocatableTotal PE / Free PE ? ?3073 / 0PV Name ? ? ? ? ? ? ? /dev/sda3 ? ??PV UUID ? ? ? ? ? ? ? S2kmTF-YDWR-CzTt-7Krv-wUWk-elwu-xwQdBfPV Status ? ? ? ? ? ? allocatableTotal PE / Free PE ? ?9675 / 1996


? ?


8、根目錄大小依然沒變化,

[root@backup03 ~]# df -h? Filesystem ? ? ? ? ? ? ? Size ?Used Avail Use% Mounted on /dev/mapper/centos-root ? 10G ?9.7G ?394M ?97% / devtmpfs ? ? ? ? ? ? ? ? 471M ? ? 0 ?471M ? 0% /dev tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /dev/shm tmpfs ? ? ? ? ? ? ? ? ? ?488M ?8.6M ?479M ? 2% /run tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /sys/fs/cgroup /dev/sda1 ? ? ? ? ? ? ? ?197M ?135M ? 62M ?69% /boot tmpfs ? ? ? ? ? ? ? ? ? ? 98M ?4.0K ? 98M ? 1% /run/user/42 tmpfs ? ? ? ? ? ? ? ? ? ? 98M ? 36K ? 98M ? 1% /run/user/0 /dev/sr0 ? ? ? ? ? ? ? ? 4.2G ?4.2G ? ? 0 100% /run/media/root/CentOS 7 x86_64 [root@backup03 ~]#?

9,確認root文件系統的類型是xfs后,使用xfs_growfs命令擴展根目錄大小。

[root@backup03 ~]# mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=481808k,nr_inodes=120452,mode=755) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices) cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event) cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls) cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer) cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset) configfs on /sys/kernel/config type configfs (rw,relatime) /dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota) selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13748) debugfs on /sys/kernel/debug type debugfs (rw,relatime) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel) mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel) /dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime) tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=99796k,mode=700,uid=42,gid=42) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=99796k,mode=700) gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0) /dev/sr0 on /run/media/root/CentOS 7 x86_64 type iso9660 (ro,nosuid,nodev,relatime,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2) [root@backup03 ~]#?


?

10,使用xfs_growfs命令擴展根目錄大小

[root@backup03 ~]# xfs_growfs /dev/centos/root meta-data=/dev/mapper/centos-root isize=512 ? ?agcount=4, agsize=655360 blks= ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? attr=2, projid32bit=1= ? ? ? ? ? ? ? ? ? ? ? crc=1 ? ? ? ?finobt=0 spinodes=0 data ? ? = ? ? ? ? ? ? ? ? ? ? ? bsize=4096 ? blocks=2621440, imaxpct=25= ? ? ? ? ? ? ? ? ? ? ? sunit=0 ? ? ?swidth=0 blks naming ? =version 2 ? ? ? ? ? ? ?bsize=4096 ? ascii-ci=0 ftype=1 log ? ? ?=internal ? ? ? ? ? ? ? bsize=4096 ? blocks=2560, version=2= ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? sunit=0 blks, lazy-count=1 realtime =none ? ? ? ? ? ? ? ? ? extsz=4096 ? blocks=0, rtextents=0 data blocks changed from 2621440 to 10485760

11,最后使用df命令,確認根目錄大小已經從原來的10GB擴展為40GB。

[root@backup03 ~]# ?df -h Filesystem ? ? ? ? ? ? ? Size ?Used Avail Use% Mounted on /dev/mapper/centos-root ? 40G ?9.7G ? 31G ?25% / devtmpfs ? ? ? ? ? ? ? ? 471M ? ? 0 ?471M ? 0% /dev tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /dev/shm tmpfs ? ? ? ? ? ? ? ? ? ?488M ?8.6M ?479M ? 2% /run tmpfs ? ? ? ? ? ? ? ? ? ?488M ? ? 0 ?488M ? 0% /sys/fs/cgroup /dev/sda1 ? ? ? ? ? ? ? ?197M ?135M ? 62M ?69% /boot tmpfs ? ? ? ? ? ? ? ? ? ? 98M ?4.0K ? 98M ? 1% /run/user/42 tmpfs ? ? ? ? ? ? ? ? ? ? 98M ? 36K ? 98M ? 1% /run/user/0 /dev/sr0 ? ? ? ? ? ? ? ? 4.2G ?4.2G ? ? 0 100% /run/media/root/CentOS 7 x86_64 [root@backup03 ~]#?

?

總結

以上是生活随笔為你收集整理的centos7根目录root扩容操作记录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。