Failed to load after shrinking Amazon EBS

I have followed several links on Google and these forums to reduce the amount of EBS on Amazon AWS, including these links:

http://wiki.jokeru.ro/shrink-amazon-ebs-root-volume

and

http://www.lantean.co/shrinking-ebs-volume/

I have a 254 GB EBS that needs to be changed to 150 GB. Here are the steps I took:

  • Create a new 8GB instance / dev / xvde (base OS)
  • Mount 254 GB The volume of / dev / xvdj on the base OS.
  • Mount the 150GB empty volume / dev / xvdk on the base OS.
  • / dev / xvdj has 8 partitions as follows:

Disk /dev/xvdj: 272.7 GB, 272730423296 bytes
255 heads, 63 sectors/track, 33157 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029527

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdj1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvdj2              13        6540    52428800   83  Linux
/dev/xvdj3            6540       10457    31457280   83  Linux
/dev/xvdj4           10457       33114   181998592    5  Extended
/dev/xvdj5           10457       11501     8388608   82  Linux swap / Solaris
/dev/xvdj6           11501       12154     5242880   83  Linux
/dev/xvdj7           12154       12285     1048576   83  Linux
/dev/xvdj8           12285       33114   167314432   83  Linux
      

Run codeHide result


  1. Since / dev / xvdk is an empty volume, it does not have a partition which I suppose should be created under / dev / xvdj
  2. According to the links above, I ran e2fsck -f / dev / xvdj1 and then resize2fs -M -p / dev / xvdj1 , for all partitions on / dev / xvdj (except / dev / xvdj4 and 5)
  3. After running the above command, I created partitions on the / dev / xvdk volume as required, with sizes in mind that will be larger than the / dev / xvdj partitions
  4. The 150 GB partitions are as follows:

Disk /dev/xvdk: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeea3d8c8

Device     Boot      Start         End      Blocks   Id  System
/dev/xvdk1   *           1         132     1060258+  83  Linux
/dev/xvdk2             133        9271    73409017+  83  Linux
/dev/xvdk3            9272       17105    62926605   83  Linux
/dev/xvdk4           17106       19581    19888470    5  Extended
/dev/xvdk5           17106       18150     8393931   82  Linux swap / Solaris
/dev/xvdk6           18151       19456    10490413+  83  Linux
/dev/xvdk7           19457       19581     1004031   83  Linux
    
      

Run codeHide result


  1. For the first partition, I also added a boot flag using fdisk / dev / xvdk and choosing a and the partition number (which is 1)
  2. After the sections, I followed the following links for counting blocks by issuing the dd command to copy the data.
  3. When the dd command was complete, I ran e2fsck -f / dev / xvdk1 and then resize2fs -p / dev / xvdk1 , for all partitions in / dev / xvdk (except / dev / xvdk4 and 5)
  4. After running the above command, I turned off the base OS and then unplugged the 150GB volume.
  5. I took a snapshot of a 150GB volume, and after taking the snapshot, I created an image (AMI) from that snapshot.
  6. I used this image to start an instance which I have been successful with but after starting I cannot connect to this instance.
  7. Also, 1 out of 2 status checks throws a connection error that I can't investigate, where I might have gone wrong.

Can someone tell me where I went wrong or did I completely leave the track?

+3


source to share


1 answer


I found an elegant solution that was present in the AWS knowledge base.

The link is here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html#expanding-partition-parted



He uses a split tool.

NOTE. To resize, you need to mount the volume to another instance.

0


source







All Articles