300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > xfs分区扩容(磁盘扩容)

xfs分区扩容(磁盘扩容)

时间:2018-09-18 19:23:55

相关推荐

xfs分区扩容(磁盘扩容)

xfs分区扩容(磁盘扩容)

在VM上添加硬盘空间时,请先关机,再添加;

第一步查看对应分区是否为xfs格式

[root@web ~]# cat /etc/fstab## /etc/fstab# Created by anaconda on Wed Aug 8 15:05:49 ## Accessible filesystems, by reference, are maintained under "/dev/disk"# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#UUID=1***-9***-4***-9***-f*** / xfsdefaults 0 0UUID=7***-5***-4***-8***-1*** /boot xfsdefaults 0 0UUID=e***-2***-4***-a***-8*** swapswap defaults 0 0[root@web ~]#

第二步查看目前需要调整的分区表

[root@web ~]# df -hFilesystemSize Used Avail Use% Mounted on/dev/sda3 48G 3.7G 45G 8% /devtmpfs 2.9G0 2.9G 0% /devtmpfs 2.9G 12K 2.9G 1% /dev/shmtmpfs 2.9G 12M 2.9G 1% /runtmpfs 2.9G0 2.9G 0% /sys/fs/cgroup/dev/sda1 197M 112M 86M 57% /boottmpfs 579M0 579M 0% /run/user/1007[root@web ~]# fdisk -lDisk /dev/sda: 322.1 GB, 322122547200 bytes, 629145600 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: 0x000a8318 Device BootStart EndBlocks Id System/dev/sda1 * 2048411647204800 83 Linux/dev/sda241164846059512097152 82 Linux swap / Solaris/dev/sda3 4605952 104857599 50125824 83 Linux[root@web ~]#

其中,看到/dev/sda为磁盘,“Disk /dev/sda:322.1 GB, 322122547200 bytes, 629145600 sectors”中,322.1GB为磁盘扩容的大小;

第三步进行扩容,其中需要重启服务器

[root@web ~]# 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 mand (m for help): p # 输入p列出磁盘目前的分区情况Disk /dev/sda: 322.1 GB, 322122547200 bytes, 629145600 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: 0x000a8318 Device BootStart EndBlocks Id System/dev/sda1 * 2048411647204800 83 Linux/dev/sda241164846059512097152 82 Linux swap / Solaris/dev/sda3 4605952 104857599 50125824 83 LinuxCommand (m for help): d # 输入d然后选择分区,删除现有分区Partition number (1-3, default 3): 3# 选择删除分区表编号Partition 3 is deletedCommand (m for help): n # 输入n建立新的磁盘分区Partition type: p primary (2 primary, 0 extended, 2 free) e extendedSelect (default p): p # 创建分区Partition number (3,4, default 3): 3 # 选择分区号First sector (4605952-629145599, default 4605952):# 回车选择默认值Using default value 4605952Last sector, +sectors or +size{K,M,G} (4605952-629145599, default 629145599): # 回车选择默认值Using default value 629145599Partition 3 of type Linux and of size 297.8 GiB is setCommand (m for help): p # 确认分区建立成功Disk /dev/sda: 322.1 GB, 322122547200 bytes, 629145600 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: 0x000a8318 Device BootStart EndBlocks Id System/dev/sda1 * 2048411647204800 83 Linux/dev/sda241164846059512097152 82 Linux swap / Solaris/dev/sda3 4605952 629145599 312269824 83 LinuxCommand (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 atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@web ~]# init 6 # 重启系统### 重启中 ###[root@web ~]# xfs_growfs /dev/sda3 # 自动扩展XFS文件系统到最大的可用大小meta-data=/dev/sda3 isize=512 agcount=4, agsize=3132864 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0data= bsize=4096 blocks=12531456, imaxpct=25 = sunit=0swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=1log=internalbsize=4096 blocks=6118, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 12531456 to 78067456[root@web ~]#[root@web ~]# df -h# 查看是否挂载成功FilesystemSize Used Avail Use% Mounted on/dev/sda3 298G 3.7G 295G 2% /devtmpfs 2.9G0 2.9G 0% /devtmpfs 2.9G 12K 2.9G 1% /dev/shmtmpfs 2.9G 12M 2.9G 1% /runtmpfs 2.9G0 2.9G 0% /sys/fs/cgroup/dev/sda1 197M 112M 86M 57% /boottmpfs 579M0 579M 0% /run/user/1007[root@web ~]#

如保险起见,可在执行init 6重启服务器,确保分区生效!(每行都有步骤,请按步骤执行)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。