AWS EC2 调整云主机根卷大小

对于Redhat/Amazon Linux操作系统,请参考:

调整amazon EC2云主机的EBS启动磁盘大小(http://blog.sina.com.cn/s/blog_704836f40101anhf.html

对于centos 操作系统,需要做些额外的操作步骤,才能是根卷的大小调整生效,操作如下:

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 7.9G 802M 6.7G 11% /

tmpfs 7.3G 0 7.3G 0% /dev/shm

/dev/xvdb 493G 198M 467G 1% /mnt

[[email protected] ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 20G 0 disk

└─xvda1 202:1 0 8G 0 part /

xvdb 202:16 0 500G 0 disk /mnt

[[email protected] ~]# fdisk -u /dev/xvda

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

switch off the mode (command ‘c’).

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 16777215 8387584 83 Linux

Command (m for help): d

Selected partition 1

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First sector (63-41943039, default 63): 2048

Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):

Using default value 41943039

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 2048 41943039 20970496 83 Linux

Command (m for help): a

Partition number (1-4): 1

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 41943039 20970496 83 Linux

Command (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.

[[email protected] ~]# reboot

Broadcast message from [email protected]

(/dev/pts/0) at 3:58 …

The system is going down for reboot NOW!

[[email protected] ~]# Connection to 54.223.220.111 closed by remote host.

Connection to 54.223.220.111 closed.

[email protected] /d/work/key

$ ssh -i aws-ssh-key.pem [email protected]

[email protected] /d/work/key

$ ssh -i aws-ssh-key.pem [email protected]

Last login: Wed Jul 29 03:07:54 2015 from 223.71.247.139

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 7.9G 802M 6.7G 11% /

tmpfs 7.3G 0 7.3G 0% /dev/shm

/dev/xvdb 493G 198M 467G 1% /mnt

[[email protected] ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 20G 0 disk

└─xvda1 202:1 0 20G 0 part /

xvdb 202:16 0 500G 0 disk /mnt

[[email protected] ~]# fdisk -u /dev/xvda

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

switch off the mode (command ‘c’).

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 41943039 20970496 83 Linux

Command (m for help): d

Selected partition 1

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First sector (63-41943039, default 63): p

First sector (63-41943039, default 63): 2048

Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):

Using default value 41943039

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 2048 41943039 20970496 83 Linux

Command (m for help): a

Partition number (1-4): 1

Command (m for help): p

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 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 identifier: 0x00098461

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 41943039 20970496 83 Linux

Command (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.

[[email protected]58 ~]# reboot

Broadcast message from [email protected]

(/dev/pts/0) at 4:03 …

The system is going down for reboot NOW!

[[email protected] ~]# Connection to 54.223.220.111 closed by remote host.

Connection to 54.223.220.111 closed.

$ ssh -i aws-ssh-key.pem [email protected]

Last login: Wed Jul 29 03:59:36 2015 from 223.71.247.139

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 7.9G 802M 6.7G 11% /

tmpfs 7.3G 0 7.3G 0% /dev/shm

/dev/xvdb 493G 198M 467G 1% /mnt

[[email protected] ~]#

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 7.9G 802M 6.7G 11% /

tmpfs 7.3G 0 7.3G 0% /dev/shm

/dev/xvdb 493G 198M 467G 1% /mnt

[[email protected] ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 20G 0 disk

└─xvda1 202:1 0 20G 0 part /

xvdb 202:16 0 500G 0 disk /mnt

[[email protected] ~]# resize2fs /dev/xvda1

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/xvda1 is mounted on /; on-line resizing required

old desc_blocks = 1, new_desc_blocks = 2

Performing an on-line resize of /dev/xvda1 to 5242624 (4k) blocks.

The filesystem on /dev/xvda1 is now 5242624 blocks long.

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 20G 806M 18G 5% /

tmpfs 7.3G 0 7.3G 0% /dev/shm

/dev/xvdb 493G 198M 467G 1% /mnt

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-10 02:39:48

AWS EC2 调整云主机根卷大小的相关文章

openstack 调整云主机大小

######在主控制节点和所有的计算机节点做ssh认证 [ ! -f sshkey_tool.sh ] && wget https://files.cnblogs.com/files/blog-lhong/sshkey_tool.sh bash sshkey_tool.sh node171 root ess.com1 bash sshkey_tool.sh node172 root ess.com1 bash sshkey_tool.sh node173 root ess.com1 bas

解决linux系统CentOS下调整home和根分区大小《转》

转自http://www.php114.net/2013/1019/637.html 目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root 1.首先查看磁盘使用情况 [[email protected] ~]# df -h 文件系统 容量  已用 可用  已用% 挂载点 Filesystem             Size  Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 15

CentOS下调整home和根分区大小

由于我们有时候没法预估或者说错误的盘符分区的时候,常常会导致我们后面的操作出现极大的不方便,这里我就记录下一个错误分区后对home和根分区存储空间大小调整的整个过程! ①查看我们现有机器的分区状况 centos下载:http://www.gooln.com/other/8820.html [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_weidianserver2-lv_

解决linux系统CentOS下调整home和根分区大小

目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root 1.首先查看磁盘使用情况 [[email protected] ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 154G 7.9G 139G 6% / tmpfs 1.9G 100K 1.9G 1% /dev/shm /dev/sd

CentOS环境下下调整home和根分区大小

项目建设方给提供了3台CentOS的服务器,连接进去之后发现磁盘空间很大,但是都放在了home目录下,所以需要调整一下. 1.查看磁盘使用情况 [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_centos-lv_root 50G 9.9G 37G 22% / tmpfs 3.9G 72K 3.9G 1% /dev/shm /dev/sda1 485M 40M 421M 9

CentOS下调整home和根分区大小的方法

解决外挂硬盘的问题. 目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root 1.首先查看磁盘使用情况[[email protected]~]# df -h文件系统 容量 已用 可用 已用% 挂载点Filesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root 154G 7.9G 139G 6% /tmpfs 1.9G 100K 1.9G 1% /dev/shm/de

调整home和根分区大小

目标:将VolGroup-lv_home缩小到100G,并将剩余的空间添加给VolGroup-lv_root =========================================================================== 解决过程: # df -h //查看分区 # umount /home //取消挂载 # e2fsck -f /dev/mapper/VolGroup-lv_home //分区检测 # resize2fs -p /dev/mapper/V

在OpenStack中对云主机类型进行重新配置

实现功能:实现在openstack中能够重新调整新建的openstack主机的内存及磁盘空间大小. 当我们在openstack主机实例中操作-->调整云主机大小 的时候并没有报错,但发现云主机的内存与磁盘空间并没有变化,查询/var/log/nova/nova-compute.log 发现有如下错误: nstance: c63d6086-f899-4994-a239-8b4eb0343a13] Setting instance back to ACTIVE after: Instance rol

香港云主机

云服务器是一种类似VPS服务器的虚拟化技术,VPS是采用虚拟软件,VZ或VM在一台服务器上虚拟出多个类似独立服务器的部分,每个部分都可以做单独的操作系统,管理方法同服务器一样.提供可调整云主机配置的弹性云技术,整合了计算.存储与网络资源的Iaas服务,具备按需使用和按需即时付费能力的云主机租用服务.在灵活性.可控性.扩展性及资源复用性上都有很大的提高. 而香港云主机的主要特点有两个,一是使用了香港的网络线路资源,避免了必须备案的硬性规定,第二是使用了云计算架构,更强更丰富的云主机功能比传统主机和