DEV Community

Cover image for Detached EBS volume from your local Linux system.
Md Abu Musa
Md Abu Musa

Posted on

Detached EBS volume from your local Linux system.

To safely remove the detached EBS volume from your local Linux system, follow these steps:


Step 1: Unmount the Volume

First, ensure the volume is unmounted to prevent any data corruption or access conflicts.

umount /new_directory
Enter fullscreen mode Exit fullscreen mode
  • umount: Unmounts the filesystem from the specified directory.
  • /new_directory: Replace with the actual mount point used for the volume.

Step 2: Verify the Volume is Unmounted

Run the following commands to confirm the volume is no longer in use:

Check Mounted Filesystems:

df -hT
Enter fullscreen mode Exit fullscreen mode

The detached volume's mount point (/new_directory) should no longer appear in the output.

Check Block Devices:

lsblk
Enter fullscreen mode Exit fullscreen mode

Ensure the detached volume (/dev/xvdb, for example) is no longer listed.


Step 3: Remove the Mount Directory (Optional)

If you no longer need the directory used for mounting the volume, you can delete it:

rmdir /new_directory
Enter fullscreen mode Exit fullscreen mode
  • rmdir: Removes an empty directory.

Step 4: Clean Up Filesystem Entries (If Applicable)

If the volume was previously added to the /etc/fstab file for automatic mounting, remove the corresponding entry to prevent errors during boot:

  1. Open the /etc/fstab file:
   nano /etc/fstab
Enter fullscreen mode Exit fullscreen mode
  1. Locate and remove the line related to the detached volume.

  2. Save and exit (Ctrl+O, Enter, Ctrl+X).


Step 5: Verify Cleanup

Reboot the system or manually check to ensure no traces of the detached volume remain.


These steps ensure the EBS volume is safely and completely removed from your local Linux system after detaching it from AWS.

Top comments (0)