요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Sparse example
zero.rst:20-3710TB logical zero origin과 10GB COW partition으로 sparse device를 만드는 명령을 보존합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=======
dm-zero
=======
Device-Mapper's "zero" target provides a block-device that always returns
zero'd data on reads and silently drops writes. This is similar behavior to
/dev/zero, but as a block-device instead of a character-device.
Dm-zero has no target-specific parameters.
One very interesting use of dm-zero is for creating "sparse" devices in
conjunction with dm-snapshot. A sparse device reports a device-size larger
than the amount of actual storage space available for that device. A user can
write data anywhere within the sparse device and read it back like a normal
device. Reads to previously unwritten areas will return a zero'd buffer. When
enough data has been written to fill up the actual storage space, the sparse
device is deactivated. This can be very useful for testing device and
filesystem limitations.
To create a sparse device, start by creating a dm-zero device that's the
desired size of the sparse device. For this example, we'll assume a 10TB
sparse device::
TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors
echo "0 $TEN_TERABYTES zero" | dmsetup create zero1
Then create a snapshot of the zero device, using any available block-device as
the COW device. The size of the COW device will determine the amount of real
space available to the sparse device. For this example, we'll assume /dev/sdb1
is an available 10GB partition::
echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \
dmsetup create sparse1
This will create a 10TB sparse device called /dev/mapper/sparse1 that has
10GB of actual storage space available. If more than 10GB of data is written
to this device, it will start returning I/O errors.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
항상 zero를 반환하는 block target
1-10Device-Mapper의 `zero` target은 read에서 항상 zero-filled data를 반환하고 write는 조용히 버리는 block device를 제공합니다. Character device가 아니라 block device라는 점을 제외하면 `/dev/zero`와 비슷합니다.
dm-zero에는 target-specific parameter가 없습니다.
Storage를 소비하지 않는 deterministic block target입니다.
dm-snapshot과 sparse device
11-19dm-zero의 흥미로운 용도는 dm-snapshot과 결합해 `sparse` device를 만드는 것입니다. Sparse device는 실제 사용 가능한 storage보다 큰 device size를 보고합니다. 사용자는 sparse device 어디든 data를 쓰고 일반 device처럼 다시 읽을 수 있습니다. 아직 쓰지 않은 영역의 read는 zero-filled buffer를 반환합니다.
실제 storage가 가득 찰 만큼 data를 쓰면 sparse device를 deactivate합니다. Device와 filesystem limit를 시험할 때 매우 유용합니다.
거대한 zero origin과 작은 COW device를 snapshot target으로 결합합니다.
10TB sparse device 예제
20-37원하는 sparse device size와 같은 dm-zero device를 먼저 만듭니다. 예제는 sector 수로 계산한 10TB zero device입니다.
TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors
echo "0 $TEN_TERABYTES zero" | dmsetup create zero1
그런 다음 사용 가능한 block device를 COW device로 사용하여 zero device snapshot을 만듭니다. COW device size가 sparse device에 실제로 사용할 수 있는 공간을 결정합니다. 예제에서는 `/dev/sdb1`이 사용 가능한 10GB partition이라고 가정합니다.
echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \
dmsetup create sparse1
결과는 실제 storage 10GB를 가진 10TB sparse device `/dev/mapper/sparse1`입니다. 이 device에 10GB보다 많은 data를 쓰면 I/O error를 반환하기 시작합니다.
Reported capacity와 실제 COW capacity가 분리됩니다.
Zero target
zero.rst:1-19Parameter 없는 deterministic zero block device와 sparse snapshot origin 용도를 설명합니다.