Complete Guide to add or remove EBS Volume on running EC2 Instance

WordPress database error: [Table ‘devopph5_wp83.wpmj_aal_tasks’ doesn’t exist]
INSERT IGNORE INTO `wpmj_aal_tasks` (name, action, arguments, creation_time, next_run_time) VALUES ('575832fad02a757b006af2bebfbf5dc6', 'aal_action_http_cache_renewal', 'a:4:{i:0;s:60:"https://www.amazon.in/gp/bestsellers/electronics/1375458031/";i:1;s:5:"86400";i:2;a:24:{s:7:"timeout";i:20;s:11:"redirection";i:20;s:11:"httpversion";s:3:"1.0";s:10:"user-agent";s:15:"WordPress/5.5.3";s:8:"blocking";b:1;s:7:"headers";a:0:{}s:7:"cookies";a:11:{i:0;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:1;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082787201l";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:2;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:3;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"amzn-assoc-skip_sentry";s:5:"value";s:5:"false";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:4;O:14:"WP_Http_Cookie":6:{s:4:"name";s:9:"ubid-main";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528498;s:4:"path";s:1:"/";s:6:"domain";s:9:"amazon.in";s:9:"host_only";N;}i:5;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"ac-language-preference";s:5:"value";s:5:"en_IN";s:7:"expires";i:1635528499;s:4:"path";s:1:"/";s:6:"domain";s:27:"affiliate-program.amazon.in";s:9:"host_only";N;}i:6;O:14:"WP_Http_Cookie":6:{s:4:"name";s:13:"session-token";s:5:"value";s:192:"BejI0ieHnUYnv9Fr9h SqnJikK7Af9dw0vlOZpoPkrslAVeNlEqbmNKjykQ0Bc8drR8sYyusHhziY lHf5Mtm7LKNHSCxJfjFYkVra2elDD9SXW3ZciI/WwfJgtNxRzCxQeSGp5BZBTU6rJGCEmuVHLkqcaDBAGDKbHD7ZBCtADvE2KhgSYwO RABTGw5kgf";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:7;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"i18n-prefs";s:5:"value";s:3:"INR";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:8;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:9;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082758401l";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:10;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}}s:4:"body";N;s:8:"compress";b:0;s:10:"decompress";b:1;s:9:"sslverify";b:1;s:6:"stream";b:0;s:8:"filename";N;s:6:"method";N;s:18:"reject_unsafe_urls";b:1;s:22:"constructor_parameters";a:0:{}s:14:"api_parameters";a:0:{}s:14:"compress_cache";b:0;s:5:"proxy";N;s:8:"attempts";i:0;s:20:"skip_argument_format";b:0;s:8:"interval";i:0;s:11:"renew_cache";b:0;s:15:"amazon_language";s:0:"";}i:3;s:18:"category_unit_type";}', '2022-10-31 23:10:34', '2022-10-31 23:10:34')

WordPress database error: [Table ‘devopph5_wp83.wpmj_aal_tasks’ doesn’t exist]
INSERT IGNORE INTO `wpmj_aal_tasks` (name, action, arguments, creation_time, next_run_time) VALUES ('0395e333754118080d286788c1b1460c', 'aal_action_http_cache_renewal', 'a:4:{i:0;s:60:"https://www.amazon.in/gp/bestsellers/electronics/1389432031/";i:1;s:5:"86400";i:2;a:24:{s:7:"timeout";i:20;s:11:"redirection";i:20;s:11:"httpversion";s:3:"1.0";s:10:"user-agent";s:15:"WordPress/5.5.3";s:8:"blocking";b:1;s:7:"headers";a:0:{}s:7:"cookies";a:11:{i:0;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:1;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082787201l";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:2;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:3;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"amzn-assoc-skip_sentry";s:5:"value";s:5:"false";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:4;O:14:"WP_Http_Cookie":6:{s:4:"name";s:9:"ubid-main";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528498;s:4:"path";s:1:"/";s:6:"domain";s:9:"amazon.in";s:9:"host_only";N;}i:5;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"ac-language-preference";s:5:"value";s:5:"en_IN";s:7:"expires";i:1635528499;s:4:"path";s:1:"/";s:6:"domain";s:27:"affiliate-program.amazon.in";s:9:"host_only";N;}i:6;O:14:"WP_Http_Cookie":6:{s:4:"name";s:13:"session-token";s:5:"value";s:192:"BejI0ieHnUYnv9Fr9h SqnJikK7Af9dw0vlOZpoPkrslAVeNlEqbmNKjykQ0Bc8drR8sYyusHhziY lHf5Mtm7LKNHSCxJfjFYkVra2elDD9SXW3ZciI/WwfJgtNxRzCxQeSGp5BZBTU6rJGCEmuVHLkqcaDBAGDKbHD7ZBCtADvE2KhgSYwO RABTGw5kgf";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:7;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"i18n-prefs";s:5:"value";s:3:"INR";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:8;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:9;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082758401l";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:10;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}}s:4:"body";N;s:8:"compress";b:0;s:10:"decompress";b:1;s:9:"sslverify";b:1;s:6:"stream";b:0;s:8:"filename";N;s:6:"method";N;s:18:"reject_unsafe_urls";b:1;s:22:"constructor_parameters";a:0:{}s:14:"api_parameters";a:0:{}s:14:"compress_cache";b:0;s:5:"proxy";N;s:8:"attempts";i:0;s:20:"skip_argument_format";b:0;s:8:"interval";i:0;s:11:"renew_cache";b:0;s:15:"amazon_language";s:0:"";}i:3;s:18:"category_unit_type";}', '2022-10-31 23:10:34', '2022-10-31 23:10:34')

WordPress database error: [Table ‘devopph5_wp83.wpmj_aal_tasks’ doesn’t exist]
INSERT IGNORE INTO `wpmj_aal_tasks` (name, action, arguments, creation_time, next_run_time) VALUES ('0f8670fbade0a679ad00329c60cbc014', 'aal_action_http_cache_renewal', 'a:4:{i:0;s:58:"https://www.amazon.in/gp/bestsellers/computers/1375424031/";i:1;s:5:"86400";i:2;a:24:{s:7:"timeout";i:20;s:11:"redirection";i:20;s:11:"httpversion";s:3:"1.0";s:10:"user-agent";s:15:"WordPress/5.5.3";s:8:"blocking";b:1;s:7:"headers";a:0:{}s:7:"cookies";a:11:{i:0;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:1;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082787201l";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:2;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";s:14:".www.amazon.in";s:9:"host_only";N;}i:3;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"amzn-assoc-skip_sentry";s:5:"value";s:5:"false";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:4;O:14:"WP_Http_Cookie":6:{s:4:"name";s:9:"ubid-main";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528498;s:4:"path";s:1:"/";s:6:"domain";s:9:"amazon.in";s:9:"host_only";N;}i:5;O:14:"WP_Http_Cookie":6:{s:4:"name";s:22:"ac-language-preference";s:5:"value";s:5:"en_IN";s:7:"expires";i:1635528499;s:4:"path";s:1:"/";s:6:"domain";s:27:"affiliate-program.amazon.in";s:9:"host_only";N;}i:6;O:14:"WP_Http_Cookie":6:{s:4:"name";s:13:"session-token";s:5:"value";s:192:"BejI0ieHnUYnv9Fr9h SqnJikK7Af9dw0vlOZpoPkrslAVeNlEqbmNKjykQ0Bc8drR8sYyusHhziY lHf5Mtm7LKNHSCxJfjFYkVra2elDD9SXW3ZciI/WwfJgtNxRzCxQeSGp5BZBTU6rJGCEmuVHLkqcaDBAGDKbHD7ZBCtADvE2KhgSYwO RABTGw5kgf";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:7;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"i18n-prefs";s:5:"value";s:3:"INR";s:7:"expires";N;s:4:"path";s:1:"/";s:6:"domain";N;s:9:"host_only";N;}i:8;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"session-id";s:5:"value";s:19:"262-9084554-3099618";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:9;O:14:"WP_Http_Cookie":6:{s:4:"name";s:15:"session-id-time";s:5:"value";s:11:"2082758401l";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}i:10;O:14:"WP_Http_Cookie":6:{s:4:"name";s:10:"ubid-acbin";s:5:"value";s:19:"985-3237990-3868068";s:7:"expires";i:1635528500;s:4:"path";s:1:"/";s:6:"domain";s:10:".amazon.in";s:9:"host_only";N;}}s:4:"body";N;s:8:"compress";b:0;s:10:"decompress";b:1;s:9:"sslverify";b:1;s:6:"stream";b:0;s:8:"filename";N;s:6:"method";N;s:18:"reject_unsafe_urls";b:1;s:22:"constructor_parameters";a:0:{}s:14:"api_parameters";a:0:{}s:14:"compress_cache";b:0;s:5:"proxy";N;s:8:"attempts";i:0;s:20:"skip_argument_format";b:0;s:8:"interval";i:0;s:11:"renew_cache";b:0;s:15:"amazon_language";s:0:"";}i:3;s:18:"category_unit_type";}', '2022-10-31 23:10:34', '2022-10-31 23:10:34')

This tutorial is a complete guide to add or remove EBS Volume on running Ec2 Instance without downtime

 

EBS Volume

Amazon Elastic Block Storage(EBS) volume provides persistent block storage volumes to use with Amazon EC2 Instances in AWS Cloud.

EBS Volume is nothing but a Virtual Hard Drive attached with EC2 Instance.

You can attach an EBS Volume to only one EC2 Instance and also multiple EBS Volumes can be attached to an EC2 Instance.

You cannot attach an EBS volume to multiple EC2 Instances. Think EBS Volume like a Physical Hard Drive , as you cannot attach a Physical hard Drive to Multiple Servers.

Amazon EBS Volume attached to an EC2 Instance, and EC2 Instance both must be always in the same Availability Zone.

Amazon EBS Volumes are highly flexible, we can modify EBS volume and its type on the fly without shutting down the EC2 Instance.

Read about: How to extend  EBS Volume with zero downtime

 

 

Add or Remove EBS Volume on running Ec2 Instance

 

This  includes attach and  detach EBS volume to EC2 Instance ; mount EBS volume to Linux and Windows Instance ; Delete EBS Volume from AWS Account.

 

Attach EBS volume to ec2 instance

 

Step 1 – Login to AWS account

Navigate to Services——-> EC2 ——-> Elastic Block Store —- > Volumes

Click on Create Volume

 

Step 2 – Create Volume

Enter the following details to create Volume

Choose from one the the Volume Types :

I am choosing General Purpose SSD(GP2) here that is most commonly used Volume types for general purpose.

Select Available Zone : Select the same Availability Zone as EC2 Instance to which you want to attach the new Volume

Add Tag :  Enter your Key and Its Value

Click on Create Volume

 

 

Your  EBS Volume will be created Successfully

 

 

 

Step 3 – Attach ebs volume to ec2 instance 

Now Select the newly created EBS Volume in Step 2 , and click on Actions , and then Click on Attach Volume

 

 

Enter the Instance ID to which you want to add an additional EBS Volume

Enter the Device Name as /dev/sdf or /dev/sdg etc for Linux Instance. For windows Instance put sdf or xvdf etc only. By default Device Name is picked automatically when you select the Instance ID,  If not , you can enter any device name that is not already attached with your Instance.

Click on Attach

 

Step 4- Mount ebs volume to ec2 instance

 

Mount EBS Volume to ec2 Instance Linux

SSH your EC2 Linux Instance

 

 

Switch to root user by Sudo Su

Run df -h to show all mounted partitions  and lsblk to show all connected devices to the Linux Box.

You can see the device xvdf is connected as per lsblk output , but it’s not showing in df -h output as it is not mounted.

 $ sudo su

 $ df -h

 $ lsblk

 

You can also use fdisk -l to see all available disk partition on your Linux Instance.

$ fdisk -l

 

 

Format the volume with ext4 file system

$ msfs.ext4 /dev/xvdf

 

 

Now create a new directory e.g /NewVolume

 $ mkdir /NewVolume

 

 

Mount the Volume with newly created directory.

$ mount /dev/xvdf /NewVolume/

 

 

Now again run df -h command to see the mounted Volume.

You can see the newly created volume is mounted now.

 

 

Create a test file to check if everything is good.

$ touch /NewVolume/test.txt

 

 

 $ ls /NewVolume

 

 

Permanently Mount the EBS Volume

$ nano /etc/fstab

Add the following line in /etc/fstab

/dev/xvdf /NewVolume ext4 defaults,nofail  0 0

 

 

After entering the entries in /etc/fstab run mount -a command

$ mount -a

 

 

Mount EBS Volume to ec2 Instance Windows

 

Login to Windows Instance using RDP

Open Run and enter compmgmt.msc

Navigate to Disk Management

 

 

You can see the newly added volume as Unallocated Disk

Right Click on Disk and Click on Initialize Disk

 

Choose partition style as  MBR or GPT . Maximum partition capacity for MBR is 2 TB, while for GPT is 9.4 ZB

Click on OK

Again Right Click on Unallocated Space and Click on New Simple Volume

 

Choose File System as NTFS and   Click Next

 

Assign Drive Letter

Click Next

 

Click Next

 

 

Click Next

 

Click on Finish

You will now able to access the Volume on your Windows Instance

 

Detach EBS volume from ec2 instance

 

Select the EBS Volume to be detach, and click on Actions, then Click on Detach Volume

 

Click on Yes, Detach

 

Delete EBS Volume

 

Select the EBS Volume  to be deleted, and click on Actions and then click on Delete Volume

 

Click on Yes, Delete to confirm

 

I hope you enjoyed this tutorial and learned complete guide to add or remove EBS Volume on running Ec2 Instance.  If you think this article is helpful, please do share this post with others as well. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your queries.

If you want to learn more on AWS services , read – Important List of AWS Services

Thank You so much !

If you think we helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

You may also like…

Leave a Reply

Your email address will not be published. Required fields are marked *