首页 > 系统相关 >Linux基础——根目录扩容

Linux基础——根目录扩容

时间:2022-11-11 23:45:51浏览次数:32  
标签:扩容 tmpfs centos bytes dev Linux 根目录 512 root

1、准备扩容/dev/mapper/centos-root [root@ceph-admin ~]# df -Th Filesystem              Type      Size  Used Avail Use% Mounted on devtmpfs                devtmpfs  484M     0  484M   0% /dev tmpfs                   tmpfs     496M     0  496M   0% /dev/shm tmpfs                   tmpfs     496M  6.8M  489M   2% /run tmpfs                   tmpfs     496M     0  496M   0% /sys/fs/cgroup /dev/mapper/centos-root xfs       9.8G  8.2G  1.7G  84% / /dev/sda1               xfs      1014M  205M  810M  21% /boot tmpfs                   tmpfs     100M     0  100M   0% /run/user/0   2、查看可用磁盘/dev/sdb [root@ceph-admin ~]# fdisk -l   Disk /dev/sda: 12.9 GB, 12884901888 bytes, 25165824 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: 0x000d06ab      Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048     2099199     1048576   83  Linux /dev/sda2         2099200    25165823    11533312   8e  Linux LVM   Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 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 /dev/mapper/centos-root: 10.5 GB, 10515120128 bytes, 20537344 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 /dev/mapper/centos-swap: 1287 MB, 1287651328 bytes, 2514944 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   3、创建分区/dev/sdb1 [root@ceph-admin ~]# fdisk /dev/sdb 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.   Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xca473b44.   Command (m for help): m              Command action    a   toggle a bootable flag    b   edit bsd disklabel    c   toggle the dos compatibility flag    d   delete a partition    g   create a new empty GPT partition table    G   create an IRIX (SGI) partition table    l   list known partition types    m   print this menu    n   add a new partition    o   create a new empty DOS partition table    p   print the partition table    q   quit without saving changes    s   create a new empty Sun disklabel    t   change a partition's system id    u   change display/entry units    v   verify the partition table    w   write table to disk and exit    x   extra functionality (experts only)   Command (m for help): n Partition type:    p   primary (0 primary, 0 extended, 4 free)    e   extended Select (default p): Using default response p Partition number (1-4, default 1): 1 First sector (2048-25165823, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-25165823, default 25165823): Using default value 25165823 Partition 1 of type Linux and of size 12 GiB is set   Command (m for help): p   Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 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: 0xca473b44      Device Boot      Start         End      Blocks   Id  System /dev/sdb1            2048    25165823    12581888   83  Linux   Command (m for help): w The partition table has been altered!   Calling ioctl() to re-read partition table. Syncing disks.   4、查看分区/dev/sdb1 [root@ceph-admin ~]# lsblk NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT sda               8:0    0   12G  0 disk ├─sda1            8:1    0    1G  0 part /boot └─sda2            8:2    0   11G  0 part   ├─centos-root 253:0    0  9.8G  0 lvm  /   └─centos-swap 253:1    0  1.2G  0 lvm  [SWAP] sdb               8:16   0   12G  0 disk └─sdb1            8:17   0   12G  0 part   6、创建物理卷/dev/sdb1 [root@ceph-admin ~]# pvcreate /dev/sdb1   Physical volume "/dev/sdb1" successfully created.   7、查询物理卷/dev/sdb1 [root@ceph-admin ~]# pvdisplay   --- Physical volume ---   PV Name               /dev/sda2   VG Name               centos   PV Size               <11.00 GiB / not usable 3.00 MiB   Allocatable           yes   PE Size               4.00 MiB   Total PE              2815   Free PE               1   Allocated PE          2814   PV UUID               0JO4Gd-o6tb-VdXZ-Lp87-QhXI-NHlM-M8JMOA       "/dev/sdb1" is a new physical volume of "<12.00 GiB"   --- NEW Physical volume ---   PV Name               /dev/sdb1   VG Name                  PV Size               <12.00 GiB   Allocatable           NO   PE Size               0      Total PE              0   Free PE               0   Allocated PE          0   PV UUID               cnP7e2-MHFa-rS8u-9foh-m4kq-MD7x-OCaQ1h   8、查看卷组名称centos [root@ceph-admin ~]# vgdisplay   --- Volume group ---   VG Name               centos   System ID                Format                lvm2   Metadata Areas        1   Metadata Sequence No  3   VG Access             read/write   VG Status             resizable   MAX LV                0   Cur LV                2   Open LV               2   Max PV                0   Cur PV                1   Act PV                1   VG Size               <11.00 GiB   PE Size               4.00 MiB   Total PE              2815   Alloc PE / Size       2814 / 10.99 GiB   Free  PE / Size       1 / 4.00 MiB   VG UUID               Um6Uo9-NS4w-IEK3-EwVj-GZcc-Z2mY-nK1HN0     9、通过vgextend将新添加卷/dev/sdb1加入到卷组centos中 [root@ceph-admin ~]# vgextend vgextend centos /dev/sdb1   Device centos not found. [root@ceph-admin ~]# vgextend centos /dev/sdb1   Volume group "centos" successfully extended   10、扩容卷组后,卷组空余块 [root@ceph-admin ~]# vgdisplay   --- Volume group ---   VG Name               centos   System ID                Format                lvm2   Metadata Areas        2   Metadata Sequence No  4   VG Access             read/write   VG Status             resizable   MAX LV                0   Cur LV                2   Open LV               2   Max PV                0   Cur PV                2   Act PV                2   VG Size               22.99 GiB   PE Size               4.00 MiB   Total PE              5886   Alloc PE / Size       2814 / 10.99 GiB   Free  PE / Size       3072 / 12.00 GiB   VG UUID               Um6Uo9-NS4w-IEK3-EwVj-GZcc-Z2mY-nK1HN0     11、通过lvextend命令扩展根目录挂载点/dev/mapper/centos-root [root@ceph-admin ~]# lvextend -L +12G /dev/mapper/centos-root   Size of logical volume centos/root changed from 9.79 GiB (2507 extents) to 21.79 GiB (5579 extents).   Logical volume centos/root successfully resized.   [root@ceph-admin ~]# df -Th Filesystem              Type      Size  Used Avail Use% Mounted on devtmpfs                devtmpfs  484M     0  484M   0% /dev tmpfs                   tmpfs     496M     0  496M   0% /dev/shm tmpfs                   tmpfs     496M  6.8M  489M   2% /run tmpfs                   tmpfs     496M     0  496M   0% /sys/fs/cgroup /dev/mapper/centos-root xfs       9.8G  8.2G  1.7G  84% / /dev/sda1               xfs      1014M  205M  810M  21% /boot tmpfs                   tmpfs     100M     0  100M   0% /run/user/0   12、同步文件系统 [root@ceph-admin ~]# xfs_growfs /dev/mapper/centos-root meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=641792 blks          =                       sectsz=512   attr=2, projid32bit=1          =                       crc=1        finobt=0 spinodes=0 data     =                       bsize=4096   blocks=2567168, 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 2567168 to 5712896   13、查看根目录挂载点“/”已经扩容 [root@ceph-admin ~]# df -Th Filesystem              Type      Size  Used Avail Use% Mounted on devtmpfs                devtmpfs  484M     0  484M   0% /dev tmpfs                   tmpfs     496M     0  496M   0% /dev/shm tmpfs                   tmpfs     496M  6.8M  489M   2% /run tmpfs                   tmpfs     496M     0  496M   0% /sys/fs/cgroup /dev/mapper/centos-root xfs        22G  8.2G   14G  38% / /dev/sda1               xfs      1014M  205M  810M  21% /boot tmpfs                   tmpfs     100M     0  100M   0% /run/user/0 [root@ceph-admin ~]#

标签:扩容,tmpfs,centos,bytes,dev,Linux,根目录,512,root
From: https://www.cnblogs.com/gkhost/p/16882446.html

相关文章

  • Linux基础——内核排查过程
    根因:(内核BUG)BUG:unabletohandlekernelNULLpointerdereferenceat0000000000000019,代码调用函数assign_irq_vector报错,通过升级内核版本进行修复。解决办法:  ......
  • Linux安装php-vld扩展
     安装查看opcode利器vld,记录一下开发机安装php-vld过程。一、准备工作  Linux开发机一台;  Nginx、PHP已安装。二、安装phpvld扩展2.1、下载文件下载:​​http://p......
  • linux将程序放在后台运行
    &:使用&只能是将像mysqld一样已经做成守护进程的程序有效,否则关掉终端,照样挂nohup:这是一个好方法,但是nohup使用时,对于非os内建命令只能使用绝对路径调用如:nohup/opt/j......
  • 在linux  NETBEAN7.4中使用 XDEBUG…
    第二步,我们要将xdebug配置起来.1.进行xdebug的官方 ​​​http://www.xdebug.org/​​​.2 进入下载页面选择适合你的版本下载. ​​​http://www.xdebug.org/downlo......
  • 关于单机最大tcp连接数 及 linux …
    在tcp应用中,server事先在某个固定端口监听,client主动发起连接,经过三路握手后建立tcp连接。那么对单机,其最大并发tcp连接数是多少?如何标识一个TCP连接ip, local port,remo......
  • Linux 运行进程实时监控pidstat命…
    简介pidstat主要用于监控全部或指定进程占用系统资源的情况,如CPU,内存、设备IO、任务切换、线程等。pidstat首次运行时显示自系统启动开始的各项统计信息,之后运行pidstat将显......
  • linux sed 简单使用
    操作系统最大的一个好处是它带有各种各样的实用工具。存在如此之多不同的实用工具,几乎不可能知道并了解所有这些工具。可以简化关键情况下操作的一个实用 工具是 sed。它......
  • 教你使用monit监控Linux系统
    Monit是用于对系统中的进程、文件、目录、以及设备等进行监视和管理的工具。当你所指定的server宕机或者没有反应,monit会将该进程杀死并重启该server。并通过邮件进行通......
  • 自有服务器搭建git并同步到网站根目录,实现git更新网站
    一.GIT安装yuminstall-ygit服务器端创建git用户[root@localhosthome]#idgitid:git:无此用户[root@localhosthome]#useraddgit[root@localhosthom......
  • 通过禁用Ping包响应、使用密钥登录等方式来提高Linux服务端系统安全
    有时候我们成功登录到Linux服务器时,会看到控制台会有类似于这样的打印Lastfailedlogin:FriNov1112:59:55CST2022fromxxx.xxx.xxx.xxxonssh:xxxTherewas999......