Mount an AWS EFS filesystem on an EC2 instance with Ansible

If you run your infrastructure inside Amazon's cloud (AWS), and you need to mount a shared filesystem on multiple servers (e.g. for Drupal's shared files folder, or Magento's media folder), Amazon Elastic File System (EFS) is a reliable and inexpensive solution. EFS is basically a 'hosted NFS mount' that can scale as your directory grows, and mounts are free—so, unlike many other shared filesystem solutions, there's no per-server/per-mount fees; all you pay for is the storage space (bandwidth is even free, since it's all internal to AWS!).

I needed to automate the mounting of an EFS volume in an Amazon EC2 instance so I could perform some operations on the shared volume, and Ansible makes managing things really simple. In the below playbook—which easily works with any popular distribution (just change the nfs_package to suit your needs)—an EFS volume is mounted on an EC2 instance:

Format the built-in eMMC storage on an Orange Pi Plus

To use the built-in 8GB of eMMC storage on the Orange Pi Plus as a writable volume in Linux, you need to delete the existing partitions (I think mine were formatted as FAT/WIN32), create a new partition, format the partition, then mount it:

  1. Delete the existing partitions:
    1. sudo fdisk /dev/mmcblk1
    2. p to list all partitions, then d and a number to delete all existing partitions, then w to write the changes.
  2. Create a new partition:
    1. sudo fdisk /dev/mmcblk1
    2. n to create a new partition, then use all the defaults, then w to write the changes.
  3. Format the partition: sudo mkfs.ext4 -L "emmc" /dev/mmcblk1p1
  4. Create a mount point: sudo mkdir /emmc
  5. Mount the disk: mount /dev/mmcblk1p1 /emmc
Subscribe to RSS - mount