LVM disk resize işlemi
Vmware üstünde çalışan bir linux makinenin diskini artırdım. LVM üstündende bunu yapmak gerekiyor tabi ki.
[root@localhost ~]# fdisk -l Disk /dev/sda: 85.9 GB, 85899345920 bytes 255 heads, 63 sectors/track, 10443 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: 0x0008a7d6 Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/mapper/VolGroup-lv_root: 5981 MB, 5981077504 bytes 255 heads, 63 sectors/track, 727 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/mapper/VolGroup-lv_root doesn`t contain a valid partition table Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes 255 heads, 63 sectors/track, 514 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/mapper/VolGroup-lv_swap doesn`t contain a valid partition table
Öncelikle yeni bir partition oluşturuyoruz.
[root@localhost ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It`s strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (1306-10443, default 1306): Using default value 1306 Last cylinder, +cylinders or +size{K,M,G} (1306-10443, default 10443): Using default value 10443 Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
Reboot işleminden sonra, pvcreate komutu ile oluşturduğumuz diski LVM görecek şekilde oluşturuyoruz.
[root@localhost ~]# pvcreate /dev/sda3 Writing physical volume data to disk "/dev/sda3" Physical volume "/dev/sda3" successfully created
lvdisplay ile var olan konfigürasyona bakıyoruz.
[root@localhost ~]# lvdisplay --- Logical volume --- LV Name /dev/VolGroup/lv_root VG Name VolGroup LV UUID IqdsSn-2dBV-QDhf-Ym13-c7vy-v79b-EQv6UK LV Write Access read/write LV Status available # open 1 LV Size 5.57 GiB Current LE 1426 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Name /dev/VolGroup/lv_swap VG Name VolGroup LV UUID Bvh8l4-DNXF-WmXy-z7Hi-7oVi-VJhb-4Fl7wC LV Write Access read/write LV Status available # open 1 LV Size 3.94 GiB Current LE 1008 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1
Sıra geldi Volume Group’u vgextend ile büyütmeye.
[root@localhost ~]# vgextend VolGroup /dev/sda3 Volume group "VolGroup" successfully extended
Baktığımızda;
[root@localhost ~]# vgdisplay --- Volume group --- VG Name VolGroup System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 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 79.50 GiB PE Size 4.00 MiB Total PE 20353 Alloc PE / Size 2434 / 9.51 GiB Free PE / Size 17919 / 70.00 GiB VG UUID QxKsuL-3ke0-sZHW-e4cA-Rqyq-6vRg-zjCc2m
LVM’de total size istediğimiz gibi oldu. Şimdi diskimizi büyütelim artık.
[root@localhost ~]# lvextend -L +70GB /dev/mapper/VolGroup-lv_root Extending logical volume lv_root to 75.57 GiB Insufficient free space: 17920 extents needed, but only 17919 available
Bu hatanın sebebi şu eklediğimiz boş alan tam olarak 70GB değil ( 69 küsür GB ) o yüzden 69GB olarak veriyoruz.
lvextend komutu ile de “Free PE / Size” alanında belirtilen kadar boş alanı kullanıp diski extend ediyoruz.
df ile baktığımızda göründüğü gibi disk alanını hala eskisi gibi.
[root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 5749032 1584584 3872404 30% / tmpfs 1960684 0 1960684 0% /dev/shm /dev/sda1 495844 56486 413758 13% /boot
[root@localhost ~]# lvextend -L +69GB /dev/mapper/VolGroup-lv_root Extending logical volume lv_root to 74.57 GiB Logical volume lv_root successfully resized
Extend işleminden sonra resize2fs ile lvm e eklediğimiz disk alanını linux dosya sisteminde genişletiyoruz.
[root@localhost ~]# resize2fs /dev/mapper/VolGroup-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 5 Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 19548160 (4k) blocks. The filesystem on /dev/mapper/VolGroup-lv_root is now 19548160 blocks long.
df ile baktığımızda göründüğü gibi artık diskimiz istediğimiz boyuta büyüdü.
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 74G 1.6G 69G 3% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/sda1 485M 56M 405M 13% /boot
Posted in File Systems, Linux on June 26th, 2012 by Kürşad DARA | | 0 Comments
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log hatası
MySQL’de replikasyon yaptığım slave sunucuda bazı işlemler yapmam gerekti. Sonrasında;
mysql> CHANGE MASTER TO MASTER_HOST='xx.xx.xx.xx', MASTER_USER='slave_user' ,MASTER_PASSWORD='xxx' ,MASTER_LOG_FILE='mysql-bin.001788' ,MASTER_LOG_POS=549864673; ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
hatasını aldım.
Tabii ki yapmak gereken çok basit
mysql> flush slave; Query OK, 0 rows affected (0.00 sec)
sonrasında problemsiz devam edebilirsiniz.
Posted in Linux, MySQL on June 22nd, 2012 by Kürşad DARA | | 0 Comments