2

For using a cluster filesystem like OCFS or sharing read-only data between machines, one needs to attach the same SAN volume/LUN to multiple servers at the same time.

How can I do that with EBS volumes on Amazon EC2 ?

console.aws.amazon.com seems not to allow attaching an already attached volume and the Amazon documentation doesn't contain "multiattach". Perhaps I need another keyword to search for ?

8

You cannot do this. The EC2 API does not allow for it.

  • 1
    @Juergen, this is documented in the EBS section of the EC2 faq: Q: Do you support multiple instances accessing a single volume? While you are able to attach multiple volumes to a single instance, attaching multiple instances to one volume is not supported at this time. – Michael - sqlbot May 27 '16 at 22:08
3

If you want to do this, use Elastic File System rather than EBS

https://aws.amazon.com/efs/

Notes:

  1. Its still in Preview (has been for months, but lots of people are using it)

  2. It can be expensive

  • That has already been suggested in another answer, where I commented: EFS is file oriented, not block oriented. And S3 seems not useful for block storage (= mounting as a Linux block device). – Juergen Jun 2 '16 at 9:19
  • And it is similar to a network drive in the fstab. Costs are high until realise you are not paying for unused capacity. For volatile needs it can be cheaper. Good for logs and archives or a staging area. (Semaphores and tokens as well if you are database averse). – mckenzm Feb 13 '18 at 1:55
2

EBS is for a single instance only. Sharing an EBS instance would be like putting the same physical disk in two machines.

If you want two instances of the disk you can create an EBS snapshot or an AMI based on that EBS disk. This would let you run multiple instances of a web server, for example.

If you really want shared storage for data look at Amazon EFS, or you could use S3.

  • EFS is file oriented, not block oriented. And S3 seems not useful for block storage (= mounting as a Linux block device), or is it ? – Juergen May 29 '16 at 12:14
  • I think you're right, EFS and S3 are file storage not block storage, and that EBS is the only block store on Amazon. What are you actually trying to achieve? Multiple instances of the same server running? – Tim May 29 '16 at 19:20
  • Actually I wanted to use OCFS and Cluster LVM in a 3-node-cluster, which needs a shared SAN as its basis. Now it seems clear that cannot be done, not even using drbd as a SAN replacement, because drbd only allows two and not three mirrored disks. I'll be trying gluster instead. – Juergen Jun 2 '16 at 9:23
  • You could perhaps consider setting up one of the EC2 instances as a file server? – Tim Jun 2 '16 at 19:18
  • That single non-clustered file server instance would be the single point of failure that I wanted to prevent from. That's why I asked for multiattach to support OCFS as filesystem in the question. – Juergen Jun 3 '16 at 13:03
1

As stated by EEAA, you can not do that.

However, a workaround exists: attach the EBS volume to a single Linux instance, then export the device via iSCSI. Now on the "client" instances you simply had to attach the volume as a normal iSCSI drive.

Fot the sake of completeness: remember that traditional filesystems are not cluster aware. If you concurrently mount a disk from two iSCSI client, you will (more or less) instantly corrupt your filesystem (ext4 at least; xfs has some security safeguard that should prevent a double-mount). You had to use a cluster aware filesystem, as OCFS (as you suggested) or GFS2.

  • Using a singe "gateway" instance would destroy the cluster approach of preventing from a single point of failure. And if I had a multiattach feature, I would not only use it for a cluster filesystem, but also for Cluster LVM: Allocate a sufficiently large Block of several gigabytes from Amazon and suballocate (and free) smaller blocks to resize individual filesystems as needed. – Juergen May 29 '16 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.