网站 翻页 实现,建网站收费多少钱,关键词查询网,dede网站管理系统演示前言#xff1a; 使用虚拟机创建系统后#xff0c;/ 盘 想要扩容需要几步才能实现#xff0c;下面将介绍具体流程 确定根分区磁盘以及分区号#xff0c;和起始扇区和结束扇区
# 查看磁盘名称和分区
# 如下可看出根分区为 /dev/sda2 #xff0c;磁盘为sda
[root192 ~]# ls… 前言 使用虚拟机创建系统后/ 盘 想要扩容需要几步才能实现下面将介绍具体流程 确定根分区磁盘以及分区号和起始扇区和结束扇区
# 查看磁盘名称和分区
# 如下可看出根分区为 /dev/sda2 磁盘为sda
[root192 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 200M 0 part /boot
└─sda2 8:2 0 19.8G 0 part /
sr0 11:0 1 4.4G 0 rom
# 查看磁盘分区起始扇区号和 结束扇区号扩容时结束扇区号会变大这里根盘的结束扇区号为20765696
[root192 ~]# fdisk -lDisk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x000c795eDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 41943039 20765696 83 Linux扩容磁盘扩容指定磁盘 这里为sda 虚机必须关机后才能扩容 3. 扩容分区 扩容分区需要先删除原来分区删除原有分区不会丢失数据真实环境尽量避免业务期扩容。 3.1. 查看磁盘是否被扩容
# 可以大致看出sda磁盘被扩容了20G扇区个数从原来的41943040 变成了 83886080
[root192 ~]# fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000c795eDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 41943039 20765696 83 Linux3.2. 删除需要被扩容的分区并重新添加分区 在删除原有分区时不能点击w保存不然数据就没了正常来说需要卸载需要被扩容的分区但是由于我需要扩容的是/ 分区所以不能卸载。 [root192 ~]# 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): d # 删除分区
Partition number (1,2, default 2): 2 # 选择删除主分区就是 / 分区
Partition 2 is deletedCommand (m for help): p # 打印分区Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000c795eDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 LinuxCommand (m for help): n # 添加分区
Partition type:p primary (1 primary, 0 extended, 3 free)e extended
Select (default p): p # 添加主分区
Partition number (2-4, default 2): 2 # 添加原来的分区号
First sector (411648-83886079, default 411648): # 起始扇区号默认即可
Using default value 411648
Last sector, sectors or size{K,M,G} (411648-83886079, default 83886079): # 结束扇区号默认即可
Using default value 83886079
Partition 2 of type Linux and of size 39.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 disks3.3. 查看目前 / 分区大小确认是否被扩容
[root192 ~]# fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000c795eDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 83886079 41737216 83 Linux可以看出 /dev/sda2 的结束扇区号没有发生变化这是因为文件系统还没有被扩容。 1 查看分区的文件系统
# 可以看出 / 分区的文件系统 为 xfs
[root192 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 900M 0 900M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.6M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda2 xfs 20G 1.3G 19G 7% /
/dev/sda1 xfs 197M 120M 77M 61% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/02 扩大文件系统不同的文件系统使用不同的命令进行扩容
xfs xfs_growfsext resize2fs
# 扩大文件系统
[root192 ~]# xfs_growfs /dev/sda2
meta-data/dev/sda2 isize512 agcount4, agsize1297856 blks sectsz512 attr2, projid32bit1 crc1 finobt0 spinodes0
data bsize4096 blocks5191424, imaxpct25 sunit0 swidth0 blks
naming version 2 bsize4096 ascii-ci0 ftype1
log internal bsize4096 blocks2560, version2 sectsz512 sunit0 blks, lazy-count1
realtime none extsz4096 blocks0, rtextents0
# 查看扇区数判断是否被扩容成功/dev/sda2 结束扇区已经变成83886079成功被扩容成功
[root192 ~]# fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000c795eDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 83886079 41737216 83 Linux
# 查看系统分区容量是否被扩容这里没有被扩容的原因是需要重新挂载一下分区
[root192 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 900M 0 900M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.6M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda2 20G 1.3G 19G 7% /
/dev/sda1 197M 120M 77M 61% /boot
tmpfs 182M 0 182M 0% /run/user/0重新挂载分区 由于 / 分区的特殊性是不可能被重新挂载的因为重新挂载就必须断开一次所以这里直接重启 [root192 ~]# reboot# / 分区成功被扩容了
[root192 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 900M 0 900M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.5M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda2 40G 1.3G 39G 4% /
/dev/sda1 197M 120M 77M 61% /boot
tmpfs 182M 0 182M 0% /run/user/0