Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)
edited by

I would like to reduce EBS volume capacity with out loosing data

I would like to change the capacity from 1TB to 200 GB

Please provide me detailed steps.

1 Answer

0 votes
by (18.2k points)

Try the following steps:

1. Create a new EBS volume of the desired size. Make sure that is in the same avaialability zone as the original volume 

and attach it to the target instance.

2. SSH into your instance and run the following commands:

fdisk /dev/sdg

n (for New)

p (for Primary)

Accept defaults for other fdisk options

w (for Write)

3. Once the fdisk exits, you will have to create a file system on the new partition.

mkfs.ext4 /dev/sdg1 

presuming that ext4 was used on original partition

4. Mount the new partition to a temporary mount point using the following command:

mkdir /new

mount /dev/sdg1 /new

5. Copy the data using the following command:

cd /var cp -ax * /new/

6. Update your /etc/fstab to use the new partition for /var

/dev/sdg1   /var        ext4    defaults        0   0

7. Stop the instance, detach the original EBS Volume and keep thje smaller one.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...