Logical Volume Manager - cra16/overcast GitHub Wiki

1์‹œ๊ฐ„์ด๋ฉด LVM ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋‹ค

์†Œํ”„ํŠธ์›จ์–ด์ชฝ์€ ์›๋ฆฌ๋ณด๋‹ค ์šฉ์–ด๋ฅผ ์ดํ•ดํ•˜๋Š”๊ฒŒ ๋” ์–ด๋ ค์šด ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. ์šฉ์–ด ์ž์ฒด๊ฐ€ ์ถ”์ƒ์ ์ธ๋ฐ, ๊ทธ๋‚˜๋งˆ ์ค„์—ฌ์„œ ํ‘œํ˜„ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ํŠนํžˆ "๋…ผ๋ฆฌ์ ", "์ถ”์ƒ์ " ๋”ฐ์œ„์˜ ๋‹จ์–ด๊ฐ€ ๋“ค์–ด๊ฐ€๋ฉด ์ „ํ˜€ ๊ฐ์ด ์žกํžˆ์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค.

๊ทธ๋ž˜์„œ ์• ์ดˆ์— ํฌ๊ธฐํ•ด๋ฒ„๋ฆฌ๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค.

์‚ฌ๋žŒ์€ ์• ์ดˆ์— ์ถ”์ƒ์ ์ธ ๊ฒƒ๋ณด๋‹ค๋Š” ๊ตฌ์ฒด์ ์ธ ๊ฒƒ์„, ๋…ผ๋ฆฌ์ ์ธ ๊ฒƒ๋ณด๋‹ค๋Š” ์ง๊ด€์ ์ธ ๊ฒƒ์„ ๋” ์ž˜ ์ดํ•ดํ•œ๋‹ค. ํ•™์ž๊ฐ€ ์•„๋‹Œ ํ‰๋ฒ”ํ•œ ์‚ฌ๋žŒ๋“ค์ด ์ง€๊ธˆ ์ˆ˜์ค€์˜ ์ถ”์ƒ์ ์ธ ์ƒ๊ฐ์„ ํ•œ๊ฑฐ๋Š” 2์„ธ๊ธฐ๊ฐ€ ์ฑ„ ์•ˆ๋˜์ง€ ์‹ถ๋‹ค. ๊ทธ๋Ÿฌ๋‹ˆ ๋จธ๋ฆฌ์— ๋“ค์–ด์˜ฌ๋ฆฌ๊ฐ€ ๋งŒ๋ฌดํ•˜๋‹ค.

๊ฐ€์žฅ ์ข‹์€ ๋ฐฉ๋ฒ•์€ ๊ตฌ์ฒดํ™”ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๊ตฌ์ฒดํ™”ํ•˜๋Š” ๊ฐ€์žฅ ์ข‹์€ ๋ฐฉ๋ฒ•์€ ์ž์‹ ์˜ ๊ฒฝํ—˜์„ ์ง์ ‘ ๊ธ€๋กœ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฒƒ์ด๋‹ค. ๊ทธ๋ฆผ์ด ํฌํ•จ๋œ๋‹ค๋ฉด ๊ทธ๋ณด๋‹ค ์ข‹์„ ์ˆ˜ ์—†๊ฒ ๋‹ค.

ํ•ด์„œ ํ•œ ์‹œ๊ฐ„์ด๋ฉด, LVM์„ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ธ€๊ณผ ๊ทธ๋ฆผ์œผ๋กœ ์„ค๋ช…์„ ํ•ด๋ณผ๊นŒ ํ•œ๋‹ค. ๊ทธ๋ ‡๋‹ค๊ณ  ํ•ด๋„ ๋ฆฌ๋ˆ…์Šค ์šด์˜์ฒด์ œ๋ฅผ ์–ด๋Š ์ •๋„๋Š” ๋‹ค๋ฃฐ์ˆ˜ ์žˆ์–ด์•ผ ํ•˜๊ฒ ๋‹ค.

LVM ๊ตฌ์กฐ

๋ฆฌ๋ˆ…์Šค ์‹œ์Šคํ…œ์—์„œ Volume์„ ๋งŒ๋“œ๋Š” ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•์€ ๋ธ”๋ก ๋””๋ฐ”์ด์Šค์— ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ๋งŒ๋“ค์–ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋˜๊ฒ ๋‹ค. ํŒŒ์ผ ์‹œ์Šคํ…œ์€ ํ˜•์‹์— ๋งž๊ฒŒ ํฌ๋งทํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. ๊ทธ๋ฆผ์œผ๋กœ ๊ทธ๋ ค๋ณด์ž๋ฉด ๋Œ€๋žต ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

๋ธ”๋Ÿญ ์žฅ์น˜์ธ /dev/sda1, /dev/sda2๋ฅผ ํŒŒ์ผ ์‹œ์Šคํ…œ์— ๋งˆ์šดํŠธ ํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.

๋งŒ์•ฝ /dev/sda1 ์„ /mnt/ftp์— ๋งˆ์šดํŠธ ํ•ด์„œ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ํ•˜๋ฉด ๋œ๋‹ค.

# mkfs -t ext4 /dev/sda1                 # ํฌ๋งทํ•˜๊ณ 
# mount -t ext4 /dev/sda2 /usr/data/ftp  # ๋งˆ์šดํŠธํ•œ๋‹ค.

์ด ๋ฐฉ์‹์€ ํŒŒ์ผ ์‹œ์Šคํ…œ๊ณผ ์žฅ์น˜๊ฐ€ ์ง์ ‘ ๋งตํ•‘๋˜๊ธฐ ๋•Œ๋ฌธ์— ์‚ฌ์šฉ์ด ์ง๊ด€์ ์ด๋ผ๋Š” ์žฅ์ ์ด ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ํ•˜๋“œ์›จ์–ด๋ฅผ ์ง์ ‘ ๋‹ค๋ฃจ๋Š” ๊ธฐ์ˆ ๋“ค์ด ๊ทธ๋ ‡๋“ฏ์ด __์œ ์—ฐํ•˜์ง€ ์•Š๋‹ค__๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค. ์ฒ˜์Œ /dev/sda1์˜ ํฌ๊ธฐ๋ฅผ 10G๋กœ ์žก์•˜๋Š”๋ฐ, ์šฉ๋Ÿ‰์ด ๋ถ€์กฑํ•˜๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ? ์žฅ์น˜๋ฅผ ์ƒˆ๋กœ ๋งˆ๋ จํ•˜๋Š” ๋ฐฉ๋ฒ• ๋ฐ–์— ์—†๋‹ค. ์žฅ์น˜๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ๋ฌถ์–ด์„œ ํฌ๊ธฐ๋ฅผ ๋Š˜๋ฆฌ๋Š” ๊ฒƒ๋„ ์‰ฌ์šด ์ผ์ด ์•„๋‹ˆ๋‹ค. ํŒŒํ‹ฐ์…˜์„ ๋‚˜๋ˆ ์•ผ ํ•  ๊ฒฝ์šฐ๋„ ๊ฐ™๋‹ค.

ํŠนํžˆ ๋Œ€๋Ÿ‰์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ผ์ด ๋งŽ์€ ์š”์ฆ˜์—๋Š” disk๋ฅผ ํ•จ๊ป˜ ๋ฌถ์–ด์„œ ๋‹จ์ผํ•œ ๊ฑฐ๋Œ€ storage๋ฅผ ๊ตฌ์„ฑํ•ด์•ผ ํ•  ํ•„์š”์„ฑ์ด ๋Š˜์–ด๋‚˜๊ณ  ์žˆ๋‹ค. ๋ฌผ๋ฆฌ์ ์ธ ๋ณผ๋ฅจ์„ ๋…ผ๋ฆฌ์ ์ธ ๋‹จ์ผ ๋ณผ๋ฅจ์œผ๋กœ ๋ฌถ๋Š” ๊ฒƒ์ด๋‹ค.

์ด๋•Œ LVM์„ ์‚ฌ์šฉํ•œ๋‹ค. Logical์ด๋ž€ ๋ง์€ ๋Œ€์ƒ์„ ์ถ”์ƒํ™” ํ•˜๊ฒ ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. File System๊ณผ ๋ธ”๋Ÿญ ๋””๋ฐ”์ด์Šค ์‚ฌ์ด์— ์ถ”์ƒํ™” ๊ณ„์ธต์„ ํ•˜๋‚˜ ๋” ๋‘๋Š” ๊ฐœ๋…์ด๋‹ค. ์•„๋ž˜ ๊ทธ๋ฆผ์„ ๋ณด๋ผ.

๋…ผ๋ฆฌ์ ์ธ ๋ณผ๋ฅจ์„ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด์„œ ๋ธ”๋Ÿญ ์žฅ์น˜๋“ค์„ ํ•˜๋‚˜๋กœ ๋ฌถ์—ˆ๋‹ค. ๊ทธ ๋‹ค์Œ ์ ์ ˆํ•œ ํฌ๊ธฐ๋กœ ๋‚˜๋ˆ ์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. ๋…ผ๋ฆฌ์ ์ด๋‹ˆ ๋งŒํผ ๋ณผ๋ฅจ์„ ์ƒˆ๋กœ ๋งŒ๋“ค๊ฑฐ๋‚˜ ๊ธฐ์กด ๋ณผ๋ฅจ์˜ ํฌ๊ธฐ๋ฅผ ๋Š˜๋ฆฌ๊ฑฐ๋‚˜ ํ•˜๋Š” ์ผ์„ ์ž์œ ๋กญ๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐœ์ธ์ด ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ๋ณผ๋ฅจ์„ ๋‚˜๋ˆ„์–ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์— ๊ด€์‹ฌ์ด ์žˆ์„ ๊ฒƒ์ด๊ณ . Cloud ์ชฝ ์ผ์„ ํ•˜๋Š” ์‚ฌ๋žŒ์ด๋ผ๋ฉด ๋ณผ๋ฅจ์„ ํ•˜๋‚˜๋กœ ๋ฌถ๋Š” ๊ฒƒ์— ๊ด€์‹ฌ์ด ๋งŽ์„ ๊ฒƒ์ด๋‹ค.

LVM์ด๋ผ๋Š” ๊ฒƒ์€ Logical Volume๋ฅผ Managingํ•˜๋Š” ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” Storage ์†Œํ”„ํŠธ์›จ์–ด์ธ ์…ˆ์ด๋‹ค.

LVM๋ฅผ ์ข€ ๋” ์ž์„ธํžˆ ์‚ดํŽด ๋ณด์ž. LVM์—์„œ ๊ฐ€์žฅ ๋ฐ‘์— ์žˆ๋Š”๊ฒŒ ๋ฌผ๋ฆฌ์  ๋ณผ๋ฅจ์ด๋‹ค. ์ด๊ฒƒ์„ PV(Physical Volume)๋ผ๊ณ  ํ•œ๋‹ค. ์œ„ ๊ทธ๋ฆผ์€ 2๊ฐœ์˜ PV๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  PV๋Š” PE๋ผ๋Š” ๋ธ”๋Ÿญ์˜ ๋ชจ์Œ์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. PE๋Š” Physical Extents์˜ ์ค„์ž„๋ง์ด๋‹ค.

PV์œ„์— VG๊ฐ€ ์žˆ๋‹ค. Volume Group์˜ ์ค„์ž„๋ง์ธ๋ฐ, PV๋ฅผ ๋…ผ๋ฆฌ์ ์œผ๋กœ ๋ฌถ์€ ๋ณผ๋ฅจ ๊ทธ๋ฃน์ด๋‹ค. VG๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ PV๋กœ ๊ตฌ์„ฑ์ด ๋œ๋‹ค. ์ด์ œ LVM์— Volume์„ ์š”์ฒญํ•˜๋ฉด, ์š”์ฒญํ•œ ํฌ๊ธฐ๋งŒํผ LV๋ฅผ ๋Œ๋ ค์ค€๋‹ค. ์ด LV๋ฅผ (/mnt/ftp ๋“ฑ์—)๋งˆ์šดํŠธ ํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. ๋งŒ์•ฝ /mnt/ftp์˜ ๋ณผ๋ฅจ ํฌ๊ธฐ๋ฅผ ํ‚ค์šธ๋ ค๋ฉด ๋‚จ๋Š” PE๋ฅผ ์š”์ฒญํ•ด์„œ LV ํฌ๊ธฐ๋ฅผ ํ‚ค์šฐ๋ฉด ๋œ๋‹ค.

LVM์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค

๋Œ€๋žต LVM์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค์„ ์ •๋ฆฌํ•ด๋ณด์ž.

  1. ์ƒˆ๋กœ์šด ๋ธ”๋Ÿญ ์žฅ์น˜๋ฅผ ์ถ”๊ฐ€ํ•  ๊ฒฝ์šฐ, ๊ธฐ์กด ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๋ณ€๊ฒฝ ์—†์ด ๋ณผ๋ฅจ์˜ ํฌ๊ธฐ ์กฐ์ • ๊ฐ€๋Šฅ.
  2. ๊ฐ„๋‹จํ•˜๊ฒŒ LV๋ฅผ ํ™•์žฅ ๊ฐ€๋Šฅ.
  3. LV๋กœ ๋ถ€ํ„ฐ ์ฝ๊ธฐ ์ „์šฉ์˜ snapshot๋ฅผ ์ƒ์„ฑ ๊ฐ€๋Šฅ.
  4. RAID 0์ฒ˜๋Ÿผ PV๋ฅผ 2๊ฐœ ์ด์ƒ ์—ฎ์–ด์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ๊ณ  ์“ฐ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅ. ๋Œ€์—ญํญ ์ฆ๊ฐ€.
  • ํ•˜์ง€๋งŒ parity ๊ธฐ๋Šฅ์€ ์—†์Œ. fault toleranceํ•˜์ง€ ์•Š์Œ.
  1. RAID 1์ฒ˜๋Ÿผ mirror ๊ตฌ์„ฑ์„ ํ•  ์ˆ˜ ์žˆ์Œ.

Linear Mapping LV ์™€ Striped Mapping LV

์œ„์—์„œ RAID 0 ์ฒ˜๋Ÿผ PV๋ฅผ ์—ฎ์–ด์„œ ๋Œ€์—ญํญ์„ ์ฆ๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณธ๋‹ค.

  • Linear Mapping LV: ์ผ๋ฐ˜์ ์ธ ๋ฐฉ์‹์ด๋‹ค. ๋ธ”๋Ÿญ ์žฅ์น˜์— ๋ฐ์ดํ„ฐ๋ฅผ ์“ฐ๋“ฏ์ด ์ˆœ์ฐจ์ ์œผ๋กœ ์“ด๋‹ค.
  • Striped Mapping LV: ๋‘ ๊ฐœ์˜ PV๋ฅผ stripingํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค. PV์˜ PE๋Š” ์ ๋‹นํ•œ ํฌ๊ธฐ์˜ ์กฐ๊ฐ๋“ค๋กœ ๋‚˜๋ˆ„์–ด์ง€๋Š”๋ฐ, LVM์€ ๋ฐ์ดํ„ฐ๋ฅผ ๋‘ PV์— ๋ถ„์‚ฐํ•˜์—ฌ ํ• ๋‹น์„ ํ•œ๋‹ค. ๊ทธ๋ž˜์„œ ๋‘๊ฐœ์˜ PV์—์„œ ๋™์‹œ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ๊ณ  ์“ธ์ˆ˜ ์žˆ๊ฒŒ ๋˜์–ด์„œ ๋Œ€์—ญํญ ์ฆ๊ฐ€ ํšจ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ๋ฌผ๋ก  ์ด๋Ÿฐ ํšจ๊ณผ๋ฅผ ์–ป์„๋ ค๋ฉด PV๊ฐ€ ๋…๋ฆฝ๋œ ์žฅ์น˜์—ฌ์•ผ ํ•œ๋‹ค. ๊ฐ™์€ ์žฅ์น˜๋‚ด์˜ ํŒŒํ‹ฐ์…˜์ด๋ผ๋ฉด ์˜คํžˆ๋ ค ์—ญํšจ๊ณผ๊ฐ€ ๋‚  ๊ฒƒ์ด๋‹ค.

Snapshot LV

์„œ๋น„์Šค์˜ ์ค‘์ง€ ์—†์ด ๋ฐฑ์—…์„ ํ•˜๋ ค๊ณ  ํ•  ๋•Œ๋Š” ๋ฐฑ์—… ๊ณผ์ • ๋„์ค‘ ๋ฐ์ดํ„ฐ์˜ ๋ณ€๊ฒฝ์„ ํŠนํžˆ ์‹ ๊ฒฝ์จ์•ผ ํ•œ๋‹ค. ์ด ๋ฌธ์ œ๋Š” Snapshot LV๋ฅผ ์ด์šฉํ•ด์„œ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜๋ฉด ํŠน์ • ์‹œ์ ์˜ ๋ฐ์ดํ„ฐ ์ƒํƒœ๋ฅผ ๊ณ ์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ณ ์ •ํ•˜๊ธฐ ์›ํ•˜๋Š” LV๋ฅผ ๋ณต์‚ฌํ•ด์„œ ์ฝ๊ธฐ ์ „์šฉ์˜ ์ƒˆ๋กœ์šด LV๋ฅผ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค.

Linux LVM

Linux์—์„œ LVM์„ ํ…Œ์ŠคํŠธ ํ•ด๋ณด์ž. ๋‘ ๊ฐœ์˜ SATA ๋””๋ฐ”์ด์Šค๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์ด๋ฆ„์€ PV1 PV2, ํฌ๊ธฐ๋Š” 2G byte๋กœ ์„ค์ •ํ–ˆ๋‹ค.

ํ˜„์žฌ ์žฅ์น˜ ์ƒํƒœ ํ™•์ธ

VM์„ ์‹คํ–‰ํ•œ ๋‹ค์Œ fdisk๋กœ ์žฅ์น˜ ์ƒํƒœ๋ฅผ ํ™•์ธ.

# fdisk -l
....
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2G byte ํฌ๊ธฐ์˜ ๋ธ”๋Ÿญ ์žฅ์น˜๊ฐ€ ๊ฐ๊ฐ /dev/sdb, /dev/sdc์— ๋งˆ์šดํŠธ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

pv ํ™•์ธํ•˜๊ธฐ

ํ˜„์žฌ ์‹œ์Šคํ…œ์˜ physical volume์„ ๋จผ์ € ํ™•์ธํ•ด ๋ณด์ž.

# pvscan 
No matching physical volumes found

๋งŒ๋“  pv๊ฐ€ ์—†์œผ๋ฏ€๋กœ ๋‹น์—ฐํžˆ ๋œจ์ง€ ์•Š๋Š”๋‹ค.

pv ๋งŒ๋“ค๊ธฐ

์ด์ œ pv๋ฅผ ๋งŒ๋“ค์–ด ๋ณด์ž.

# pvcreate /dev/sdb /dev/sdc
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created

๋‹ค์‹œ ํ•œ๋ฒˆ pvscan์œผ๋กœ ํ™•์ธ.

# pvscan
  PV /dev/sdb                      lvm2 [2.00 GiB]
  PV /dev/sdc                      lvm2 [2.00 GiB]
  Total: 2 [4.00 GiB] / in use: 0 [0   ] / in no VG: 2 [4.00 GiB]

vg ๋งŒ๋“ค๊ธฐ

์ด์ œ vg๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. lv์˜ ๊ทธ๋ฃน์œผ๋กœ ํ•˜๋‚˜ ์ด์ƒ์˜ PV๋ฅผ ๋ณผ๋ฅจ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ์–ด์ค€๋‹ค.

# vgcreate myVG /dev/sdb /dev/sdc
  Volume group "myVG" successfully created

lv ๋งŒ๋“ค๊ธฐ

์ด์ œ lv๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. ํฌ๊ธฐ๋Š” 1G๋กœ ์žก์•„์ค€๋‹ค.

# lvcreate -L 1000M myVG
  Logical volume "lvol0" created

lvdisplay๋กœ lv ์ •๋ณด๋ฅผ ํ™•์ธํ•ด ๋ณด์ž.

#lvdisplay 
  --- Logical volume ---
  LV Name                /dev/myVG/lvol0
  VG Name                myVG
  LV UUID                fxc9Lm-MmRh-JTg2-rt6u-2shi-KvPN-udIS73
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1000.00 MiB
  Current LE             250
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

/dev/myVG/lvol0์œผ๋กœ ์ž˜ ์ƒ์„ฑ๋˜์—ˆ์Œ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

mountํ•ด์„œ ์ž˜ ์‚ฌ์šฉํ•˜๊ธฐ

์ด์ œ ํŒŒ์ผ ์‹œ์Šคํ…œ ์‚ฌ์šฉํ•˜๋“ฏ์ด ํฌ๋งทํ•˜๊ณ  ๋งˆ์šดํŠธํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

# mkfs.ext4 /dev/myVG/lvol0 
# mount -t ext4 /dev/myVG/lvol0 /mnt/ftp/
# mount | grep mnt
/dev/mapper/myVG-lvo10 /mnt/ftp  type ext4 (rw)

Volume ๊ด€๋ฆฌํ•˜๊ธฐ

๋ณผ๋ฅจ ํฌ๊ธฐ ํ‚ค์šฐ๊ธฐ. ์‚ฌ์šฉํ•˜๋‹ค ๋ณด๋‹ˆ ๋ณผ๋ฅจ์ด ๊ฝ‰์ฐผ๋‹ค. LV์˜ ํฌ๊ธฐ๋ฅผ 500M ๋งŒํผ ์ฆ๊ฐ€์‹œ์ผœ ๋ณด์ž.

# lvextend -L+500M /dev/myVG/lvol0 /dev/sdb /dev/sdc 
  Extending logical volume lvol0 to 1.46 GiB
  Logical volume lvol0 successfully resized

lv ํฌ๊ธฐ๊ฐ€ ํ™•์žฅ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ง€๊ธˆ์€ ๋ณผ๋ฅจ๋งŒ ์ปค์ง„ ์ƒํƒœ์ด๋ฉฐ ์‹ค์ œ ํŒŒ์ผ ์‹œ์Šคํ…œ์€ ํ™•์žฅ๋˜์ง€ ์•Š์€ ์ƒํƒœ์ด๋‹ค.

# df -h
/dev/mapper/myVG-lvol0  985M   18M  918M   2% /mnt/ftp

ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ๋Š˜๋ ค๋ณด์ž. ํฌ๋งทํ•˜์ง€ ์•Š๊ณ  ํŒŒํ‹ฐ์…˜์˜ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•ด์ฃผ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

# resize2fs /dev/myVG/lvol0
resize2fs 1.41.14 (22-Dec-2010)
Filesystem at /dev/myVG/lvol0 is mounted on /mnt/ftp; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/myVG/lvol0 to 384000 (4k) blocks.
The filesystem on /dev/myVG/lvol0 is now 384000 blocks long.

๋งˆ์ง€๋ง‰์œผ๋กœ df๋‚˜ cfdisk๋กœ ํŒŒํ‹ฐ์…˜ ํฌ๊ธฐ๊ฐ€ ์‹ค์ œ๋กœ ์ฆ๊ฐ€ํ–ˆ๋Š”์ง€ ํ™•์ธํ•˜๋ฉด ๋œ๋‹ค.