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 볼륨 연결하기

왼쪽 탐색 표시줄에서 Elastic Block Store 아래의 Volumes을 클릭하여 모든 볼륨을 확인합니다. 목록에서 이전 단계에서 제공된 고유 이름 태그를 검색하여 새로 생성한 볼륨을 선택할 수도 있습니다.


Screenshot 2023-09-27 at 10.24.55 AM.png

  1. Actions을 클릭하고 Attach Volume을 추가로 클릭합니다.

  2. Attach Volume 대화 상자에서 인스턴스 필드를 클릭하고 목록에서 Instance ID 또는 이름 태그를 찾아 EC2 인스턴스를 선택합니다. Attach(연결)를 클릭하여 볼륨을 연결합니다.

Screenshot 2023-09-27 at 10.25.54 AM.png

성공적으로 연결된 경우 - 표시된 볼륨 목록에서 새 볼륨의 상태(상태 열 아래)가  In Use임을 나타내는 것을 볼 수 있습니다. 

Screenshot 2023-09-27 at 10.26.22 AM.png

  1. 왼쪽 탐색 창에서 항목 목록 맨 위에 있는 EC2 Dashboard 를 클릭합니다.

  2. Instances (running)를 선택한 다음 볼륨을 연결한 인스턴스 목록에서 EC2 인스턴스를 선택합니다.

Screenshot 2023-09-27 at 10.27.08 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. 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.pngScreenshot 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크기가 of100GB인지 size확인합니다. 100GB.예를 For들어 example:아래와 “nvme1n1”같이 as shown below:"nvme1n1":
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"nvme1n1"은 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.pngScreenshot 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.pngScreenshot 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”만듭니다. "volume1"이라는 이름을 사용하겠습니다.
sudo mkdir /mnt/volume1
  1. Mount다음 the명령을 volume사용하여 to볼륨을 “volume1”"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.pngScreenshot 2023-09-27 at 10.33.16 AM.png

Screenshot 2023-09-27 at 10.33.48 AM.pngScreenshot 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

하지만 나중에 이 장치가 필요하므로 다시 마운트하는 것을 잊지 마세요. 

sudo mount /dev/nvme1n1 /mnt/volume1