[Linux] LInux 의 dm-X 와 맵핑된 장치 찾기

리눅스는 device-mapper 의 multipath(mpath0,mpath1) 나 lvm( /dev/vg00/lv00) 에
대해서 실제 Devices 는 dm-X 장치를 사용한다.

하지만 실제 어떤 장치가 dm-X 에 맵핑 되어 있는지는 알기가 쉽지 않다.
ex)
mpath0 -> dm-0
/dev/vg00/lv00 -> dm-1

확인 방법은 아래를 참고 하기 바란다.

# dm-0 에 연결되어 있는 실제 Devices 의 내역
/sys/block/dm-0/slaves

# ls -al
total 0
drwxr-xr-x 2 root root 0 May 12 09:29 .
drwxr-xr-x 4 root root 0 May 12 09:29 ..
lrwxrwxrwx 1 root root 0 May 12 09:29 sda5 -> ../../../block/sda/sda5
lrwxrwxrwx 1 root root 0 May 12 09:29 sdb5 -> ../../../block/sdb/sdb5

# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda5  VG0  lvm2 a-   900.41G    0
  /dev/sdb5  VG0  lvm2 a-   900.41G    0

# dm-0 의 Major, minor 넘버
/sys/block/dm-0

# cat dev
253:0

# dmsetup 으로 확인하는 Major, minor 넘버
# dmsetup ls
VG0-data        (253, 0)

]# dmsetup info
Name:              VG0-data
State:             ACTIVE
Read Ahead:        512
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      253, 0
Number of targets: 1
UUID: LVM-qAMVWfCgbM1GlkyJnpue3hj156CjTWXknlknh3KpTQUfToVgnfQRj3hyVysJrolL

# cat /proc/partitions
major minor  #blocks  name

   8     0  976762584 sda
   8     1     104391 sda1
   8     2   31455270 sda2
   8     3    1052257 sda3
   8     4          1 sda4
   8     5  944148051 sda5
   8    16  976762584 sdb
   8    17     104391 sdb1
   8    18   31455270 sdb2
   8    19    1052257 sdb3
   8    20          1 sdb4
   8    21  944148051 sdb5
   9     2   31455168 md2
   9     1    1052160 md1
   9     0     104320 md0
 253     0 1888288768 dm-0
   7     0    3467786 loop0

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2010/05/12 13:56 2010/05/12 13:56
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/726

[Linux] LVM Stripe 상태 확인하기

LVM 이 stripe 으로 묶여 있을때 해당 LV 를 찾기가 쉽지 않다.

어떤 LV가 stripe 으로 묶여있는지도 기억이 잘 나지 않고...

이런 경우에 다음과 같은 옵션을 사용한다.

# lvs -v --segments
    Finding all logical volumes
  LV       VG         Attr   Start SSize   #Str Type    Stripe  Chunk
  st1      VG0        -wi-a-    0    1.95G    2 striped 512.00K    0
  st1      VG0        -wi-a- 1.95G   1.95G    2 striped 512.00K    0
  LogVol00 VolGroup00 -wi-ao    0    9.34G    1 linear       0     0
  LogVol01 VolGroup00 -wi-ao    0  544.00M    1 linear       0     0


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2009/06/28 04:07 2009/06/28 04:07
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/658

[Linux] Extending a Striped Volume

Extending a Striped Volume

# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 0 0 wz--n- 271.31G 271.31G
# lvcreate -n stripe1 -L 271.31G -i 2 vg
Using default stripesize 64.00 KB
Rounding up size to full physical extent 271.31 GB
Logical volume "stripe1" created
# lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Devices
stripe1 vg -wi-a- 271.31G /dev/sda1(0),/dev/sdb1(0)
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 1 0 wz--n- 271.31G 0
# vgextend vg /dev/sdc1
Volume group "vg" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 3 1 0 wz--n- 406.97G 135.66G
# lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe1: 34480
more required
# vgextend vg /dev/sdd1
Volume group "vg" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 4 1 0 wz--n- 542.62G 271.31G
# lvextend vg/stripe1 -L 542G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 542.00 GB
Logical volume stripe1 successfully resized
# lvextend vg/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe1: 34480
more required
# lvextend -i1 -l+100%FREE vg/stripe1

출처 : https://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Cluster_Logical_Volume_Manager/stripe_extend.html
본 문서의 모든 권한은 http://www.redhat.com 에 있습니다.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2009/06/26 23:28 2009/06/26 23:28
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/657

Taking a Backup Using Snapshots

출처 : http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html#snapbackcreate

사용자(작성자) 요청이 있을경우 자삭 합니다.


Taking a Backup Using Snapshots


Following on from the previous example we now want to use the extra
space in the "ops" volume group to make a database backup every
evening. To ensure that the data that goes onto the tape is
consistent we use an LVM snapshot logical volume.


A snapshot volume is a special type of volume that presents
all the data that was in the volume at the time the snapshot
was created. For a more detailed description, see
Section 3.8, Snapshots.
This means we
can back up that volume without having to worry about data
being changed while the backup is going on, and we don't have
to take the database volume offline while the backup is taking
place.

Note


In LVM1, this type of volume was read-only, but
LVM2 creates read/write snapshots by default.

13.4.1. Create the snapshot volume


There is a little over 500 Megabytes of free space in the "ops"
volume group, so we will use all of it to allocate space for the
snapshot logical volume. A snapshot volume can be as large or a
small as you like but it must be large enough to hold all the
changes that are likely to happen to the original volume during
the lifetime of the snapshot. So here, allowing 500 megabytes of
changes to the database volume which should be plenty.

# lvcreate -L592M -s -n dbbackup /dev/ops/databases 
lvcreate -- WARNING: the snapshot must be disabled if it gets full
lvcreate -- INFO: using default snapshot chunk size of 64 KB for "/dev/ops/dbbackup"
lvcreate -- doing automatic backup of "ops"
lvcreate -- logical volume "/dev/ops/dbbackup" successfully created



WarningFull snapshot are automatically disabled
 


If the snapshot logical volume becomes full it will be dropped
(become unusable) so it is vitally important to allocate enough space.
The amount of space necessary is dependent on the usage of the
snapshot, so there is no set recipe to follow for this. If the
snapshot size equals the origin size, it will never overflow.

13.4.2. Mount the snapshot volume


We can now create a mount-point and mount the volume

# mkdir /mnt/ops/dbbackup
# mount /dev/ops/dbbackup /mnt/ops/dbbackup

mount: block device /dev/ops/dbbackup is write-protected, mounting read-only


If you are using XFS as the filesystem you will need to add the
nouuid option
to the mount command:

# mount /dev/ops/dbbackup /mnt/ops/dbbackup -onouuid,ro

13.4.3. Do the backup


I assume you will have a more sophisticated backup strategy than
this!

# tar -cf /dev/rmt0 /mnt/ops/dbbackup
tar: Removing leading `/' from member names

13.4.4. Remove the snapshot


When the backup has finished you can now unmount the volume and
remove it from the system. You should remove snapshot volume
when you have finished with them because they take a copy of all
data written to the original volume and this can hurt
performance.

# umount /mnt/ops/dbbackup
# lvremove /dev/ops/dbbackup

lvremove -- do you really want to remove "/dev/ops/dbbackup"? [y/n]: y
lvremove -- doing automatic backup of volume group "ops"
lvremove -- logical volume "/dev/ops/dbbackup" successfully removed

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2008/11/20 09:43 2008/11/20 09:43
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/579

[Linux] LVM mirror 만들기

출처 : http://www.redhat.com/docs/manuals/csgfs/browse/4.5/SAC_Cluster_Logical_Volume_Manager/mirror_create.html
작성자의 요청시 자삭 합니다.


Creating Mirrored Volumes


When you create a mirrored volume, you specify the number of copies of the data to make with the -m argument of the lvcreate command. Specifying -m1 creates one mirror, which yields two copies of the file system: a linear logical volume plus one copy. Similarly, specifying -m2 creates two mirrors, yielding three copies of the file system.


The following command creates a mirrored logical volume with a single mirror. The volume is 50 gigabytes in size, is named mirrorlv, and is carved out of volume group vg0:

lvcreate -L 50G -m1 -n gfslv vg0

An LVM mirror divides the device being copied into regions that, by default, are 512KB in size. You can use the -R argument to specify the region size in MB. LVM maintains a small log which it uses to keep track of which regions are in sync with the mirror or mirrors. By default, this log is kept on disk, which keeps it persistent across reboots. You can specify instead that this log be kept in memory with the --corelog argument; this eliminates the need for an extra log device, but it requires that the entire mirror be resynchronized at every reboot.


The following command creates a mirrored logical volume from the volume group bigvg. The logical is named ondiskmirvol and has a single mirror. The volume is 12MB in size and keeps the mirror log in memory.

# lvcreate -L 12MB -m1 --corelog -n ondiskmirvol bigvg
Logical volume "ondiskmirvol" created

When a mirror is created, the mirror regions are synchronized. For large mirror components, the sync process may take a long time. When you are creating a new mirror that does not need to be revived, you can specify the nosync argument to indicate that an initial synchronization from the first device is not required.


You can specify which devices to use for the mirror logs and log, and which extents of the devices to use. To force the log onto a particular disk, specify exactly one extent on the disk on which it will be placed. LVM does not necessary respect the order in which devices are listed in the command line. If any physical volumes are listed that is the only space on which allocation will take place. Any physical extents included in the list that are already allocated will get ignored.


The following command creates a mirrored logical volume with a single mirror. The volume is 500 megabytes in size, it is named mirrorlv, and it is carved out of volume group vg0. The first leg of the mirror is on device /dev/sda1, the second leg of the mirror is on device /dev/sdb1, and the mirror log is on /dev/sdc1.

lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 /dev/sdb1 /dev/sdc1

The following command creates a mirrored logical volume with a single mirror. The volume is 500 megabytes in size, it is named mirrorlv, and it is carved out of volume group vg0. The first leg of the mirror is on extents 0 through 499 of device /dev/sda1, the second leg of the mirror is on extents 0 through 499 of device /dev/sdb1, and the mirror log starts on extent 0 of device /dev/sdc1. These are 1MB extents. If any of the specified extents have already been allocated, they will be ignored.

lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1:0-499 /dev/sdb1:0-499 /dev/sdc1:0

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2008/06/09 15:31 2008/06/09 15:31
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/536

LVM 간략 메뉴얼

Logical Volume Manager

장점으론 약간의 성능 향상이 있다고 하더군요...
그리고 용량을 늘리고, 줄이고가 자유롭죠

단점은... 갑작스런 하드 fail 의 대처가... 좀 힘들다는 점...

- LVM 생성 -

pvcreate 물리 디스크 추가
ex) pvcreate /dev/sdb /dev/sdc /dev/sdd

pvdisplay 추가한 물리 디스크 확인

vgcreate 볼륨 그룹 생성
ex) vgcreate vg0 /dev/sdb /dev/sdc /dev/sdd

vgdisplay 볼륨그룹 상태 확인

lvcreate 볼륨 그룹에 할당된 용량을 실질적인 파티셔닝
ex) lvcreate -L 6G -n data vg0
-L size LogicalVolumeSize
-n name LogicalVolumeName ( 파티션 레이블 )

lvdisplay 로지컬 볼륨의 상태 확인

format 하고
mount 시키면 끝.

- LVM 확장 -

vgextend 볼륨 그룹을 확장함
ex) vgextend vg0 /dev/sde

lvextend 로지컬 볼륨 확장
ex) lvextend -L +1G /dev/vg0/data

on line volume resize
resize2fs /dev/vg0/data

- LVM 축소 -

pvmove pv 교체등의 작업을 할경우 기존 pv 들어있던 정보를 다른 pv로 재 분배하는 유틸리티

lvreduce 로지컬 볼륨 축소
ex) lvreduce -L -1G /dev/vg0/data -A y
-L 사이즈 -1G
device
-A autobackup [y/n]


pvmove /dev/sde
해당 pv에 있던 데이터를 다른 pv로 재 분배
ex) /dev/sde 에 딜어있던 데이터를 라느곳으로 이동...

vgreduce 볼륨 그룹에서 해당 pv 제거
ex)
vgreduce vg0 /dev/sde
  Removed "/dev/sde" from volume group "vg0"

pvremove 해당 pv에서 완전 제거
pvremove vg0 /dev/sde
  Labels on physical volume "/dev/sde" successfully wiped


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/08/10 18:14 2007/08/10 18:14
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/453

LVM의 간략 사용법

LVM을 사용할 경우 간략 사용법 이다.

먼저 사용할 파티션과 파티셥 타입을 지정해 준다.

파티션 타입은 8e 이며


vgscan ## LVM DB 초기화
pvcrate ## 물리적 볼륨그룹 지정 ex) pvcreate /dev/sda1 /dev/sdb1
vgcreate ## 볼륨그룹 생성 ex) vgcreate vg0 /dev/sda1 /dev/sdb1
lvcreate ## 로지컬 볼륨 생성 ex) lvcreate -L 4000 -n lv0 vg0


pvdisplay , vgdisplay , lvdisplay 정보 보여주기



e2fasdm 으로 LVM 영역 확장

vgextend vg0 /dev/sdc1 ## 물리적 볼륨그룹 지정한 영역을 볼륨그룹 vg0 에 할당
pvmove /dev/


로지컬 볼륨 용량 늘리기 ex) lvextend -L +4000 /dev/vg0/lv0 ## "+" 추가 한다는 것 임.


lvreduce ## 용량 줄이기
vgreduce ## pv 줄이기

더 자세한 내용은 인터넷이나 man 페이지를 참고 하면 된다.

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/05/02 21:43 2007/05/02 21:43
이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색, 이올린 태그검색올블로그 태그검색테크노라티 태그검색태그스토리 태그검색티스토리 태그검색
Response
No Trackback , No Comment
RSS :
http://blog.seabow.pe.kr/rss/response/342


Recent Trackbacks

Calendar

«   2010/07   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Site Stats

Total hits:
78737
Today:
24
Yesterday:
78
qrcode
QrooQroo code generator