Skip to main content

저장 장치 추가하기

생성된 EC2 인스턴스에는 운영 체제를 지원하기에 충분한 저장 용량을 갖춘 루트 볼륨과 분석을 지원하는 데 필요한 몇 가지 추가 애플리케이션이 있습니다. 이제 다운로드하려는 대용량 데이터 세트(예: Raw reads, aligned sequences 등)를 수용하기 위해 추가 스토리지가 필요합니다. 따라서 추가 스토리지를 연결해야 합니다.

이 섹션에서는 다음과 같이 설명합니다:

a. EBS(Elastic Block Store) 볼륨을 생성합니다.

b. 새 볼륨을 EC2 인스턴스에 연결합니다.

c. 새 볼륨을 포맷하고 마운트합니다.

    1. 파일 시스템으로 새 볼륨을 포맷합니다.

    2. 볼륨을 마운트하고 일부 데이터를 복사합니다.

EBS 볼륨 만들기

  1. AWS 관리 콘솔 검색 창에 EC2를 입력하여 EC2 서비스로 이동합니다.

     

  2. 왼쪽 탐색 표시줄에서 Elastic Block Store 아래의 Volumes을 클릭합니다.

Screenshot 2023-09-27 at 10.19.25 AM.png

  1. Create Volume (오른쪽 상단 모서리)를 클릭하여 새 볼륨을 만듭니다.

     

  2. Create Volume 페이지에서 볼륨의 필요한 크기(예: 데이터 세트 크기에 따라 10GB 이상)를 GB 단위로 입력합니다.

이 실습에서는 10GB면 충분합니다.
중요: Availability Zone 이 볼륨을 연결할 EC2 인스턴스와 동일한지 확인하세요.

Screenshot 2023-09-27 at 10.21.34 AM.png

Screenshot 2023-09-27 at 10.22.23 AM.png

  1. Add Tag를 클릭하여 리소스에 고유한 태그를 지정합니다. 키에 '이름'을 입력하고 값에 '[your initials]-EBS'를 입력합니다.


    Screenshot 2023-09-27 at 10.23.27 AM.png

실행 중인 인스턴스에 EBS 볼륨 연결하기

    왼쪽

  1. 탐색

    On표시줄에서 the Left Navigation Bar click on Volumes under Elastic Block Store 아래의 Volumes to클릭하여 view모든 all볼륨을 the확인합니다. volumes.목록에서 Select이전 your단계에서 newly제공된 created고유 volume이름 searching태그를 the검색하여 list새로 for생성한 the볼륨을 unique선택할 Name수도 tag provided in the previous step.있습니다.


    Screenshot 2023-09-27 at 10.24.55 AM.png

  1. Click on Actions and further click on클릭하고 Attach Volume을 추가로 클릭합니다.

  2. In the Attach Volume dialog,대화 click상자에서 on인스턴스 the필드를 클릭하고 목록에서 Instance fieldID and또는 select이름 the태그를 찾아 EC2 instance인스턴스를 by looking for the Instance ID or Name Tag in the list. Click선택합니다. Attach(연결)를 to클릭하여 attach볼륨을 the volume.연결합니다.

Screenshot 2023-09-27 at 10.25.54 AM.png

If성공적으로 attached연결된 successfully경우 - In표시된 the볼륨 list목록에서 of displayed볼륨의 volumes상태(상태 you should see your new volume having a status (under the State Column) indicating아래)가  In Use임을 나타내는 것을 볼 수 있습니다. 

Screenshot 2023-09-27 at 10.26.22 AM.png

  1. On왼쪽 the탐색 left창에서 Navigation항목 pane목록 click 위에 있는 EC2 Dashboard on the클릭합니다. very top of the list of items.

  2. Select Instances (running) and선택한 then다음 select볼륨을 your연결한 인스턴스 목록에서 EC2 Instance인스턴스를 from선택합니다. the list of instances to which you attached the Volume.

Screenshot 2023-09-27 at 10.27.08 AM.png

Important중요: Note볼륨을 down마운트하는 the다음 specific단계를 device위해 name특정 for장치 the이름을 next적어 step두세요. of드라이브 mounting이름은 the표시된 volume.것과 The다를 drive name may differ from what’s shown.있습니다.

NOTE: Depending on the Linux version and the machine type, the device names may differ. The EC2 Console will generally show /dev/sdX, where X is a lower-case letter, but you may see /dev/xvdX or /dev/nvmeYn1. The following table may help with translating. Another way to help track is to pick different sizes for your EBS volumes (such as 151, 152, 153 GB for different volumes). | Device name (Console) | Alternate 1 | Alternate 2 | | — | — | — | | /dev/sda | /dev/xvda | /dev/nvme0n1 | | /dev/sdb | /dev/xvdb | /dev/nvme1n1 | | /dev/sdc | /dev/xvdc | /dev/nvme2n1 | | /dev/sdd | /dev/xvdd | /dev/nvme3n1 | | /dev/sde | /dev/xvde | /dev/nvme4n1 | | /dev/sdf | /dev/xvdf | /dev/nvme5n1 |

볼륨 마운트

  1. Log in to your EC2 Instance.

  2. List the available disks using the following command:

lsblk

The output will list the disks attached to your instance.

예시

Screenshot 2023-09-27 at 10.30.52 AM.png

NOTE: Depending on the Linux version and the machine type, the device names may differ. The EC2 Console will generally show /dev/sdX, where X is a lower-case letter, but you may see /dev/xvdX or /dev/nvmeYn1. The following table may help with translating. Another way to help track is to pick different sizes for your EBS volumes (such as 151, 152, 153 GB for different volumes).

Device name (Console) Alternate 1 Alternate 2
/dev/sda /dev/xvda /dev/nvme0n1
/dev/sdb /dev/xvdb /dev/nvme1n1
/dev/sdc /dev/xvdc /dev/nvme2n1
/dev/sdd /dev/xvdd /dev/nvme3n1
/dev/sde /dev/xvde /dev/nvme4n1
/dev/sdf /dev/xvdf /dev/nvme5n1
  1. Check for an unmounted filesystem of size 100GB. For example: “nvme1n1” as shown below:
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0  150G  0 disk
└─nvme0n1p1 259:1    0  150G  0 part /
nvme1n1     259:2    0   100G  0 disk
  1. Check if the volume has any data using the following command:
sudo file -s /dev/nvme1n1

Where “nvme1n1” is the device you noted from the previous section after attaching the device to the EC2 Instance.

If the above command output shows "/dev/nvme1n1: data", it means your volume is empty.

예)

Screenshot 2023-09-27 at 10.30.43 AM.png

  1. Format the volume to the ext4 filesystem using the following command.
sudo mkfs -t ext4 /dev/nvme1n1

NOTE: This file-system formatting step is only for a new device, DO NOT run this step while mounting an existing volume as it will wipe out all data on the device.

예)

Screenshot 2023-09-27 at 10.32.11 AM.png

  1. Create a directory of your choice to mount our new ext4 volume. Let’s use the name “volume1”.
sudo mkdir /mnt/volume1
  1. Mount the volume to “volume1” directory using the following command.
sudo mount /dev/nvme1n1 /mnt/volume1
  1. cd into the volume1 directory and check the disk space for confirming the volume mount.
cd /mnt/volume1
df -h .

The above command would show the free space in the volume1 directory.

  1. At this point, the drive is owned by root and not user. We will want to change ownership of the drive, so that you can change the contents of the drive (Add/remove files, etc).
sudo chown -R ubuntu /mnt/volume1

예)

Screenshot 2023-09-27 at 10.33.16 AM.png

Screenshot 2023-09-27 at 10.33.48 AM.png

  1. For your own information, it is possible to later remove this device. Practice unmounting, then remounting it. To unmount the volume, you have to use the following command. Make sure to be outside the directory to unmount the volume.
sudo umount /dev/nvme1n1

But하지만 we’ll나중에 need this장치가 device필요하므로 for다시 later,마운트하는 so것을 remember잊지 to마세요. re-mount it.

sudo mount /dev/nvme1n1 /mnt/volume1