2011年4月25日 星期一

CentOS 5.6 / LVM 調整

模擬環境: 新增一顆硬碟 , 將他加入現有之LVM , 並加大目前LVM之容量


 


[root@mt ~]# fdisk -l


Disk /dev/hda: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14       10011    80308935   8e  Linux LVM


Disk /dev/hdb: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes


   Device Boot      Start         End      Blocks   Id  System


 



[root@mt ~]# fdisk /dev/hdb


The number of cylinders for this disk is set to 238216.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-238216, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-238216, default 238216):
Using default value 238216


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@mt ~]# partprobe


 




[root@mt ~]# pvdisplay
  /dev/hdd: open failed: No medium found
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               76.59 GB / not usable 26.69 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              2450
  Free PE               0
  Allocated PE          2450
  PV UUID               dfXZbc-pfev-YMTz-XfiR-BveL-HUrl-fmd7Fu


[root@mt ~]# pvcreate /dev/hdb1
  Physical volume "/dev/hdb1" successfully created
[root@mt ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               76.59 GB / not usable 26.69 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              2450
  Free PE               0
  Allocated PE          2450
  PV UUID               dfXZbc-pfev-YMTz-XfiR-BveL-HUrl-fmd7Fu


  "/dev/hdb1" is a new physical volume of "114.50 GB"
  --- NEW Physical volume ---
  PV Name               /dev/hdb1
  VG Name
  PV Size               114.50 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               f82VID-oKsl-ShjT-BZed-enmP-Tum4-ZbAIpM


 


加大VG及調整LV


以上步驟已用fdisk新增一LVM分割區 /dev/hdb1 並利用 pvcreate 轉成 PV


[root@mt ~]# vgdisplay


  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               76.56 GB
  PE Size               32.00 MB
  Total PE              2450
  Alloc PE / Size       2450 / 76.56 GB
  Free  PE / Size       0 / 0
  VG UUID               yd3K0H-5IWd-N5AX-q5dZ-j9MP-2xHh-4qPRj2


[root@mt ~]# vgextend VolGroup00 /dev/hdb1
  Volume group "VolGroup00" successfully extended
[root@mt ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               191.03 GB
  PE Size               32.00 MB
  Total PE              6113
  Alloc PE / Size       2450 / 76.56 GB
  Free  PE / Size       3663 / 114.47 GB
  VG UUID               yd3K0H-5IWd-N5AX-q5dZ-j9MP-2xHh-4qPRj2



[root@mt ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                41mdX5-GhDO-8xUU-cqY8-SrMr-HfME-EnkfsL
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                74.62 GB
  Current LE             2388
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0


  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                4k7mr6-1qkt-5p35-6oD7-IwPB-lN3V-ixf56I
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.94 GB
  Current LE             62
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1


 


 




[root@mt ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       73G  2.7G   66G   4% /
/dev/hda1              99M   19M   76M  20% /boot
tmpfs                 489M     0  489M   0% /dev/shm


[root@mt ~]# cat /etc/fstab


/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0


[root@mt ~]# lvextend -L +100G /dev/VolGroup00/LogVol00
  Extending logical volume LogVol00 to 174.62 GB
  Logical volume LogVol00 successfully resized


 



[root@mt ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                41mdX5-GhDO-8xUU-cqY8-SrMr-HfME-EnkfsL
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                174.62 GB
  Current LE             5588
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0


  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                4k7mr6-1qkt-5p35-6oD7-IwPB-lN3V-ixf56I
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.94 GB
  Current LE             62
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1


[root@mt ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       73G  2.7G   66G   4% /
/dev/hda1              99M   19M   76M  20% /boot
tmpfs                 489M     0  489M   0% /dev/shm


 


 




[root@mt ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 45776896 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 45776896 blocks long.


 


 




[root@mt ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      170G  2.8G  158G   2% /
/dev/hda1              99M   19M   76M  20% /boot
tmpfs                 489M     0  489M   0% /dev/shm


 


 


沒有留言:

張貼留言

如何在 golang 裡面引用 gitlab private repo

參考文章:https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository 原文是用 gitlab.company.com 當範例,這邊改成一般帳號...