What is "Attach volume" in Amazon Web services? - linux

Are the terms used in Amazon Web Services Attach volume and Deattach volume used in reference of Amazon Elastic Block Storage; exactly same as Unix/Linux Mount and Unmount a device?

The attach volume and detach volume is the same as opening up you're computer and attaching or detaching a new disk. After you run the attach command you still need to mount the volume on the computer, format etc... same process as after you connect a new drive.

Attaching a volume means to make it physically available as a device to the operating system (as a block device). To be used as a file system, it must be mounted. Note that a raw EBS device is not formatted.
Here's a step-by-step guide to mounting an EBS volume
Brand-new EBS Volume:
http://support.rightscale.com/06-FAQs/FAQ_0012_-_How_do_I_partition,_format_and_mount_an_EBS_volume%3F
Pre-existing EBS Volume:
http://support.rightscale.com/12-Guides/Dashboard_Users_Guide/Clouds/AWS_Region/EBS_Volumes/Actions/Attach_an_EBS_Volume_to_an_instance

Related

View EBS volume-id from the Linux OS for older non-NITRO based instances

Is there any way to get volume-id for attached EBS volumes from the EC2 instance itself (Ubuntu 18.04)?
I'm trying to create shell script which will setup storage on startup, and I have to use volume ID for detecting attached storage. For now, it works fine with nvme disks and NITRO type instances, but I'm still struggling to find a way to somehow extract volume id for older instance types that are not using NVME at all (M4 for example).
lsblk --nodeps -o name,serial simply doesn't work since volume-id is not mapped to "serial"
Any suggestions?

NFS mount point as a disk device linux

A remote NAS server provides an NFS share (/myShare) to a linux client machine
From the linux client , I mounted the NFS share ( Eg./mnt/myShare )
My question is , Is it possible to convert this /mnt/myShare as a disk device (eg./dev/mydevice)
I would like to use this disk as a physical disk itself to a container to store its data.
Can device mapper be of help here.. Any leads would be of help here
--kk
Is it possible to convert this /mnt/myShare as a disk device (eg./dev/mydevice)
The answer is yes and no. Yes, because you can mount everything anywhere, i.e. you can:
mount -t nfs nas:/myShare /dev/mydevice
(provided that the directory /dev/mydevice exists).
NO, because a disk is a file under /dev, which basically exposes a set of sectors (or clusters) - other OS components use that to present a file system, which then is mounted somewhere else.
You, instead, have already a file which represents a file system. You can mount that file system wherever you want. 99% of your OS, and your programs, will not care about.
But your share is not a disk, because it is something (a directory part of a file system) exported by another machine. And this difference cannot be circumvented. I think you can live with this without problems but, if your question is literally correct, then no: an exported share is not a disk.
If you want to use the raw hard drive, then you don't need a filesystem. Perhaps your NAS server can be configured to export its storage as an iSCSI target.
NFS itself doesn't implement storage as block device.
But what you can do is the following:
Mount /myShare onto /mnt/myShare.
Create a file the size of all of myShare. For example, if myShare is 3TB in size, do truncate -s 3T /mnt/myShare/loop.img. (at this point, if you wanted a filesystem, you could have done mkfs -t ext4 /mnt/myShare/loop.img).
Set up the file as a loop device: sudo losetup /dev/loop7 /mnt/myShare/loop.img
You now have a 3TB block device on /dev/loop7, which you can see in the output of grep loop7 /proc/partitions.

How to add another volume to Linux if /dev/xvda through /dev/xvdz in use?

I have a scenario where my linux machine is already using disks attached from /dev/xvda through /dev/xvdz. (I have a raid 10 of the ephemerals, a root drive, and an attached EBS volume) I need to add another EBS volume to this server. Is there any other device reference I can use to attach it? I am not familiar enough with this device reference feature to know what I can alter in the name to attach it.
Thanks for your help.
I was able to locate more information on this:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
I used /dev/xvdba as a new device reference. This solved my problem.

How can I monitor other mount namespace?

I'm developing daemon monitoring SD card directory with using fanotify.
But, all users have their own mount namespace, so daemon can't receive fanotify event though user app writes SD card (same directory with above).
How can I monitor all mount namespace?
Each mount point needs to be manually added by fanotify_mark().
Here is is a good example:

How do I run a Docker container on a USB drive?

Suppose we have the Linux OS installed on two identical machines that supports the version of latest Docker. Then suppose we build a container image based on this OS. We can assume this image will now run on either machine. We now put this image onto a USB drive and plug it in the other identical machine.
Now, the hard part... is it possible, using that image on the USB drive to run the container on the same USB drive itself while plugged into the machine?
I'm trying to save and/or minimize memory used by the host OS by utilizing the memory on the USB drive as much as possible.
If this is possible, how would I go about setting up a demo case?
I see this question as "how do I persist Docker data on a USB device?".
On your machines, you need to mount your USB device into /var/docker. And then restart your Docker service.
However, with this solution, when you unplug the USB device, all of the containers have to be stopped. Otherwise, data will be lost.

Resources