I do not have much experience working with Linux and mounting / unmounting. I use Amazon AWS, load EC2 with Ubuntu image, and attach a new EBS volume to EC2. From the toolbar, I see that the volume is connected to :/dev/sda1 .
Now I see from this guide from Amazon that the path is likely to be changed by the kernel. Therefore, most likely, my device /dev/sda1 will be mounted, possibly /dev/xvda1 .
So, I logged in using the terminal. I am doing ls /dev/ and I really see xvda1 there. But I also see xvda . Now I want to format the device. But I do not know if the unformatted device is connected with xvda1 or xvda . I cannot list the contents of /dev/xvda1 and /dev/xvda (it says ls: cannot access /dev/xvda1/: Not a directory ). I think I need to format it first.
I tried formatting with sudo mkfs.ext4 /dev/xvda1 . It says: /dev/xvda1 is mounted; will not make a filesystem here! /dev/xvda1 is mounted; will not make a filesystem here! .
I tried formatting with sudo mkfs.ext4 /dev/xvda . It says: /dev/xvda is apparently in use by the system; will not make a filesystem here! /dev/xvda is apparently in use by the system; will not make a filesystem here!
How can I format a volume?
EDIT:
The result of the lsblk :
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 8G 0 disk `-xvda1 202:1 0 8G 0 part /
Then I tried to use the sudo mkfs -t ext4 /dev/xvda , but the same error message appears: /dev/xvda is apparently in use by the system; will not make a filesystem here! /dev/xvda is apparently in use by the system; will not make a filesystem here!
When I tried to use the mount /dev/xvda /webserver , I get an error message: mount: /dev/xvda already mounted or /webserver busy . Some websites indicate that this is also possible due to a damaged or unformatted file system. Therefore, I assume that I need to format it first before I can mount it.