How do I know the amount of data used in a volume attached to EC2 instance??

1

I started an EC2 instance with 30gb attached volume. How do I know the amount of volume used up of that 30gb??

TIA

asked 8 months ago5259 views
2 Answers
4

Hello.

If the EC2 OS is Linux, connect via SSH and execute the following command.

df -h

For Windows, connect via RDP and execute the following command using PowerShell.

fsutil volume diskfree c:
profile picture
EXPERT
answered 8 months ago
profile picture
EXPERT
reviewed 8 months ago
1
Accepted Answer

To check the amount of space used on your attached EBS (Elastic Block Store) volume in an EC2 instance, you can log into your EC2 instance and use command-line utilities to inspect the disk usage. Here's how you can do it:

For Linux-based Instances:

  1. SSH into Your EC2 Instance: Use SSH to connect to your Linux-based EC2 instance. ssh -i /path/to/your/key.pem ec2-user@your-instance-public-ip
  2. Check Disk Usage: Use the df command to check disk usage on your EC2 instance. To specifically check the EBS volume, you can use the -h option to show sizes in a human-readable format.
df -h

This command will display information about all mounted volumes, including the EBS volume you attached to your EC2 instance. Look for the volume mount point (it might be something like /dev/xvdf), its size, and the amount of used space.

  1. Check Disk Usage for a Specific Directory: If you want to check the usage of a specific directory, you can use the du command. For example, to check the size of the /var/log directory:
du -sh /var/log

This will show you the total size of the /var/log directory in a human-readable format.

For Windows-based Instances:

  1. RDP into Your EC2 Instance: Use Remote Desktop Protocol (RDP) to connect to your Windows-based EC2 instance.

  2. Check Disk Usage: Open File Explorer on your Windows instance. Right-click on the drive associated with your attached EBS volume (usually D: or E:) and select "Properties." This will show you the used space and free space on the volume.

Alternatively, you can use PowerShell to check disk usage. Open PowerShell and use the Get-Volume cmdlet:

Get-Volume

This will provide detailed information about all volumes on the system, including the used space.

By using these commands, you can determine the amount of space used on your attached EBS volume in your EC2 instance.

AWS
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions