저장 장치 추가하기
생성된 EC2 인스턴스에는 운영 체제를 지원하기에 충분한 저장 용량을 갖춘 루트 볼륨과 분석을 지원하는 데 필요한 몇 가지 추가 애플리케이션이 있습니다. 이제 다운로드하려는 대용량 데이터 세트(예: Raw reads, aligned sequences 등)를 수용하기 위해 추가 스토리지가 필요합니다. 따라서 추가 스토리지를 연결해야 합니다.
이 섹션에서는 다음과 같이 설명합니다:
a. EBS(Elastic Block Store) 볼륨을 생성합니다.
b. 새 볼륨을 EC2 인스턴스에 연결합니다.
c. 새 볼륨을 포맷하고 마운트합니다.
1. 파일 시스템으로 새 볼륨을 포맷합니다.
2. 볼륨을 마운트하고 일부 데이터를 복사합니다.
EBS 볼륨 만들기
-
AWS 관리 콘솔 검색 창에 EC2를 입력하여 EC2 서비스로 이동합니다.
-
왼쪽 탐색 표시줄에서 Elastic Block Store 아래의 Volumes을 클릭합니다.
-
Create Volume (오른쪽 상단 모서리)를 클릭하여 새 볼륨을 만듭니다.
-
Create Volume 페이지에서 볼륨의 필요한 크기(예: 데이터 세트 크기에 따라 10GB 이상)를 GB 단위로 입력합니다.
이 실습에서는 10GB면 충분합니다.
중요: Availability Zone 이 볼륨을 연결할 EC2 인스턴스와 동일한지 확인하세요.
실행 중인 인스턴스에 EBS 볼륨 연결하기
-
Click onActions을and further click on클릭하고 Attach Volume을 추가로 클릭합니다. -
In theAttach Volumedialog,대화click상자에서on인스턴스the필드를 클릭하고 목록에서 InstancefieldIDand또는select이름the태그를 찾아 EC2instance인스턴스를by looking for the Instance ID or Name Tag in the list. Click선택합니다. Attach(연결)를to클릭하여attach볼륨을the volume.연결합니다.
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임을 나타내는 것을 볼 수 있습니다.
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 |
볼륨 마운트
-
Log in to your EC2 Instance.
-
List the available disks using the following command:
lsblk
The output will list the disks attached to your instance.
예시
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 |
- 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
- 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.
예)
- 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.
예)
- Create a directory of your choice to mount our new ext4 volume. Let’s use the name “volume1”.
sudo mkdir /mnt/volume1
- Mount the volume to “volume1” directory using the following command.
sudo mount /dev/nvme1n1 /mnt/volume1
- 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.
- 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
예)
- 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