4.1 Creating a filesystem

Creating a file system

  1. From the AWS console, click Services and select EC2.
  2. Select Instances from the menu on the left.
  3. Right-click on the EC2 Initiator Instance and select Connect from the menu.
  4. From the dialog box, select the Session Manager option, as shown below:

  1. Click Connect. A new tab will be opened in your browser with a command line interface (CLI) to the EC2 Initiator Instance.

  2. Run the following command on the EC2 Initiator Instance to list disks attached:

    ls -l /dev/disk/by-path

You should get an output similar to the below where the iSCSI disk has been mounted to sda.

  1. To confirm there is no filesystem already on the disk run the following command, where device name is taken from the previous output.

    sudo file -s /dev/<DEVICENAME>

  1. Next we will run a series of commands to create a file system on the disk using mkfs. Starting with the below we can install mkfs:

    sudo yum install xfsprogs -y

  2. Then run the the mkfs command to create the file system. Note this may take a few seconds to complete.

    sudo mkfs -t xfs /dev/<DEVICENAME>

  1. We are then going to mount this new file system under data1.

    sudo mkdir /data1

    sudo mount /dev/<DEVICENAME> /data1

  2. Next we are going to create 5*1GB files, this may take a few minutes:

    for i in {1..5}; do sudo dd if=/dev/urandom bs=1048576 count=1024 of=/data1/file$i; done

  1. This can be confirmed with the following two commands. To see the list of files:

    ls -l /data1

and to see the amount of data used on the disk:

df -h