Before the beans learned how to add a new hard disk to EC2 Linux, how do I extend an existing hard drive? The basic idea is simple, back up the current hard disk, then create a new hard disk based on the backup, disconnect the old hard disk, connect the new hard disk, scan and expand the partition
First create a 2G hard drive to connect to the EC2 instance
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/34/wKiom1PXJITwQq9tAAA5Of6cdnw241.png "title=" 1.PNG " Style= "Float:none;" alt= "Wkiom1pxjitwqq9taaa5of6cdnw241.png"/>
Then the basic operation is as follows, query the current connection of the volume, you can use the fdisk-l or LSBLK command, can display the current connected disk
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/35/wKioL1PXJZWyGaUvAAAh2wvu8oc055.png "style=" float: none; "title=" 1.1.PNG "alt=" Wkiol1pxjzwygauvaaah2wvu8oc055.png "/>
Then format the new disk partition
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/34/wKiom1PXJH_j-tQfAABKWtkVQ6U490.png "style=" float: none; "title=" 1.2.PNG "alt=" Wkiom1pxjh_j-tqfaabkwtkvq6u490.png "/>
Create a/ebs mount point, load the hard disk, and create a testfile empty file on it as a test
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/35/wKioL1PXJZvSvIhWAAAumuN8Kt0977.png "style=" float: none; "title=" 1.3.PNG "alt=" Wkiol1pxjzvsvihwaaaumun8kt0977.png "/>
Next, let's see how to extend this 2G hard drive
First of all, it should be umount This example
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/35/wKioL1PXJZzhuEw3AAAJlLk3v-I884.png "style=" float: none; "title=" 1.4.PNG "alt=" Wkiol1pxjzzhuew3aaajllk3v-i884.png "/>
How to make a backup of him
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/35/wKioL1PXJZ7AqWENAAA7NnB_FfU111.png "style=" float: none; "title=" 2.PNG "alt=" Wkiol1pxjz7aqwenaaa7nnb_ffu111.png "/>
Named Test.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/34/wKiom1PXJIXABW-SAAAiwk2NmHc023.png "style=" float: none; "title=" 3.PNG "alt=" Wkiom1pxjixabw-saaaiwk2nmhc023.png "/>
This snapshot can be seen in snapshot's operator panel after creation
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/35/wKioL1PXJaOTyxNeAABvi6c-4IA527.png "title=" 4.PNG " Style= "Float:none;" alt= "Wkiol1pxjaotyxneaabvi6c-4ia527.png"/>
Create a new volume with this test snapshot
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/35/wKioL1PXJaPQoe3tAAAqrPoLhoI900.png "title=" 5.PNG " Style= "Float:none;" alt= "Wkiol1pxjapqoe3taaaqrpolhoi900.png"/>
I expanded the space to 3G when I created it.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/34/wKiom1PXJIqAil2VAAA47RQn2lg834.png "title=" 6.PNG " Style= "Float:none;" alt= "Wkiom1pxjiqail2vaaa47rqn2lg834.png"/>
Then detach the original 2G hard drive, attach the new 3G HDD
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/34/wKiom1PXJIaRdkrhAABlKAM5XZE679.png "style=" float: none; "title=" 4.1.PNG "alt=" Wkiom1pxjiardkrhaablkam5xze679.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/35/wKioL1PXJaKD0pxnAAA8JfkYfis522.png "style=" float: none; "title=" 4.2.PNG "alt=" Wkiol1pxjakd0pxnaaa8jfkyfis522.png "/>
Scan the currently loaded hard drive
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/34/wKiom1PXJIuSla1OAAAgNHciTrM975.png "style=" float: none; "title=" 7.PNG "alt=" Wkiom1pxjiusla1oaaagnhcitrm975.png "/>
Because this drive is from a snapshot, there is already a file system and I created a test document, you can use file to view the filesystem
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/35/wKioL1PXJaXjA_4BAAARSsWes2E188.png "style=" float: none; "title=" 8.PNG "alt=" Wkiol1pxjaxja_4baaarsswes2e188.png "/>
No formatting required, direct mount can be
Query the loaded device with df-h, find size or 2G
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/34/wKiom1PXJIuQtYZ7AAAcMXCcYMY234.png "style=" float: none; "title=" 9.PNG "alt=" Wkiom1pxjiuqtyz7aaacmxccymy234.png "/>
You need to expand the partition table and then query the dimensions again after the expansion.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/34/wKiom1PXJI2Tn4-iAAAwFhSWLKk189.png "style=" float: none; "title=" 10.PNG "alt=" Wkiom1pxji2tn4-iaaawfhswlkk189.png "/>
The files you created earlier are still there!
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/35/wKioL1PXJaezDNkXAAAKimjqEwU032.png "style=" float: none; "title=" 11.PNG "alt=" Wkiol1pxjaezdnkxaaakimjqewu032.png "/>
The expansion was successful.
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1532125