확장

 

# lvextend -L +100M /dev/vg_data/lv_data ( 볼륨을 확장할 device 이름)

# resize2fs /dev/vg_data/lv_data ( 온라인 상태에서 확장할 수 있는 명령어, RHEL 5 에서 사용가능)

# df -h 명령어로 확인해 보면 mount 된 볼륨이 확장된걸 확인할 수 있다.




2GB LV를 500MB 로 만드는 축소 LVM 예제

* 파일시스템 UMOUNT (필수)

[root@gfs1 ~]# e2fsck -f /dev/mapper/vggfs-lv_02
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vggfs-lv_02: 11/262144 files (9.1% non-contiguous), 25406/524288 blocks
[root@gfs1 ~]#

[root@gfs1 ~]# resize2fs /dev/mapper/vggfs-lv_02 500M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/vggfs-lv_02 to 128000 (4k) blocks.
The filesystem on /dev/mapper/vggfs-lv_02 is now 128000 blocks long.

[root@gfs1 ~]# lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao   6.09G                                     
  LogVol01 VolGroup00 -wi-ao   5.97G                                     
  LogVol00 vg_gfstest -wi-a-  97.66G                                     
  lv_01    vggfs      -wi-ao 724.00M                                     
  lv_02    vggfs      -wi-a-   2.00G       

                              
[root@gfs1 ~]# lvreduce -L -1.5G /dev/mapper/vggfs-lv_02
  WARNING: Reducing active logical volume to 512.00 MB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_02? [y/n]: y
  Reducing logical volume lv_02 to 512.00 MB
  Logical volume lv_02 successfully resized

[root@gfs1 ~]# mount /dev/mapper/vggfs-lv_02 /mnt
[root@gfs1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      6.0G  3.2G  2.5G  58% /
/dev/sda5              99M   13M   81M  14% /boot
tmpfs                  18G     0   18G   0% /dev/shm
/dev/mapper/vggfs-lv_01
                      492M   66M  402M  15% /mnt
/dev/mapper/vggfs-lv_02
                      492M   66M  402M  15% /mnt

[root@gfs1 ~]# 

'[IT] Linux > Volume' 카테고리의 다른 글

LVM PV, VG, LV 생성  (0) 2015.05.07
super block  (0) 2015.05.07
LVM Stripe LV 생성  (0) 2015.05.03
 

 파티션 생성


[root@LGDSSOP1 ~]# fdisk /dev/sdb
Command (m for help): n
 e   extended
 p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1958, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1958, default 1958):
Using default value 1958

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@LGDSSOP1 ~]#

[root@LGDSSOP1 ~]# fdisk /dev/sdc
Command (m for help): n
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1958, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1958, default 1958):
Using default value 1958

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@LGDSSOP1 ~]#.
 

 PV생성

[root@LGDSSOP1 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@LGDSSOP1 ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created


 VG Groub 생성

[root@LGDSSOP1 ~]# vgcreate VGMASTER /dev/sdb1 /dev/sdc1
Volume group "VGMASTER" successfully created

 LV생성

[root@LGDSSOP1 ~]# lvcreate -L 1024 -n lv_root VGMASTER
 Logical volume "lv_root" created
[root@LGDSSOP1 ~]# lvcreate -L 5024 -n lv_usr VGMASTER
 Logical volume "lv_usr" created
[root@LGDSSOP1 ~]# lvcreate -L 10240 -n lv_home VGMASTER
  Logical volume "lv_home" created

 

'[IT] Linux > Volume' 카테고리의 다른 글

LV Size 확장 및 축소  (0) 2015.05.07
super block  (0) 2015.05.07
LVM Stripe LV 생성  (0) 2015.05.03
 
* 슈퍼블록 위치 확인 
#dumpe2fs /dev/sda1 | grep -i superblock
  Primary superblock at 1, Group descriptors at 2-2
  Backup superblock at 8193, Group descriptors at 8194-8194
  Backup superblock at 24577, Group descriptors at 24578-24578
  Backup superblock at 40961, Group descriptors at 40962-40962
  Backup superblock at 57345, Group descriptors at 57346-57346
  Backup superblock at 73729, Group descriptors at 73730-73730

메인 슈퍼블록 1
첫번째 백업 슈퍼블록 8193, 
두번째 백업 슈퍼블록 24577, 
세번째 백업 슈퍼블록 40961, 
네번째 백업 슈퍼블록 57345, 
다섯번째 백업 슈퍼블록 73729, 

메인 슈퍼블록이 깨지면 파일시스템 전체가 정상작동하지 않는다.
이에 백업 슈퍼블록을 이용해 메인슈퍼블록을 복구할 수 있다.

* 복구
#e2fsck -b 8193 -yf /dev/sda1
or
#e2fsck -b 8193 -yf /dev/sda1 -j ext3
-y : 질문에 yes하기
-f : 강제

'[IT] Linux > Volume' 카테고리의 다른 글

LV Size 확장 및 축소  (0) 2015.05.07
LVM PV, VG, LV 생성  (0) 2015.05.07
LVM Stripe LV 생성  (0) 2015.05.03

1. PV Create

2. VG Create
3. LV Create<lv 생성시 옵션을 통해서 만든다.>
4. Format

lvcreate -i2 -L 800M -n lv_vg2_1 vg2

i2중 i는 Stripe 옵션이며 숫자 2는  vg에 포함되어있는 PV 수량을 쓰면된다.
예를 들어 VG구성 PV가 10이라면 i10이 좋을 것이다 
하지만 이것은 내 생각이며 PV가 10개라도 5개의 pv에서만 Stripe 할거라면 i5로 해도 된다.


확인 방법: 
[root@localhost ~]# lvs -v --segments
    Finding all logical volumes
  LV       VG       Attr       Start SSize   #Str Type    Stripe Chunk
  lv_root  VolGroup -wi-ao----    0   17.51g    1 linear      0     0 
  lv_swap  VolGroup -wi-ao----    0    2.00g    1 linear      0     0 
  lv_vg1_1 vg1      -wi-a-----    0  800.00m    1 linear      0     0 
  lv_vg1_2 vg1      -wi-a-----    0  800.00m    1 linear      0     0 
  lv_vg2_1 vg2      -wi-a-----    0  800.00m    2 striped 64.00k    0 
  lv_vg2_2 vg2      -wi-a-----    0  800.00m    2 striped 64.00k    0 
[root@localhost ~]# 


#man lvcreate
 -i, --stripes Stripes
              Gives  the number of stripes.  This is equal to the number of physical volumes to scatter the logical volume.  When creating a RAID 4/5/6 logical volume, the
              extra devices which are necessary for parity are internally accounted for.  Specifying -i3 would use 3 devices for striped logical  volumes,  4  devices  for
              RAID 4/5, and 5 devices for RAID 6.

'[IT] Linux > Volume' 카테고리의 다른 글

LV Size 확장 및 축소  (0) 2015.05.07
LVM PV, VG, LV 생성  (0) 2015.05.07
super block  (0) 2015.05.07

+ Recent posts