One of the struggling issues(as currently), is the ability to SSH to EC2 environment using names. DNS name in EC2 environment is too long. You cannot simply remember EC2 ip addresses. They both change once you reboot or terminate the instance. I feel that one thing we can control is the tag names. Even when the instance is rebooted, the tag names will still be the same.
So, I came up with a small script trying to access the tag name as the host for ssh.
Here is the script.
#!/bin/sh
echo "Enter tag name:"
read tag
instance=`ec2-describe-tags | grep "$tag" | cut -f3`
publicip=`ec2-describe-instances $instance | cut -f17 | tr -d '\n'`
echo $publicip
ssh -i yourpublickey.pem ubuntu@$publicip
Change it to match your environment.
dev/abyss
Linux Systems Admin, Network Admin, Network Blog, Systems Admin blog, Linux blog.
Wednesday, June 25, 2014
Tuesday, October 15, 2013
Extending LVM partition on my VMware guest
/dev/mapper/VolGroup00-LogVol00
19172036 16489208 1693236 91% /
/dev/sda1 101086 16303 79564 18% /boot
tmpfs 521396 0 521396 0% /dev/shm
-----------------------------------------------------------------
So I have some space left due to "thin" provision for my VMware guest. I created the physical drive(/dev/sdb3) by fdisk and then added to the existing LVM as follow:
[root@php-bob ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@php-bob ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
[root@php-bob ~]# lvextend -L+25G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 43.88 GB
Logical volume LogVol00 successfully resized
[root@php-bob ~]# 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 11501568 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks long.
--------------------------------------------
/dev/mapper/VolGroup00-LogVol00
44565560 16497340 25768228 40% /
/dev/sda1 101086 16303 79564 18% /boot
tmpfs 521396 0 521396 0% /dev/shm
19172036 16489208 1693236 91% /
/dev/sda1 101086 16303 79564 18% /boot
tmpfs 521396 0 521396 0% /dev/shm
-----------------------------------------------------------------
So I have some space left due to "thin" provision for my VMware guest. I created the physical drive(/dev/sdb3) by fdisk and then added to the existing LVM as follow:
[root@php-bob ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@php-bob ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
[root@php-bob ~]# lvextend -L+25G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 43.88 GB
Logical volume LogVol00 successfully resized
[root@php-bob ~]# 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 11501568 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks long.
--------------------------------------------
/dev/mapper/VolGroup00-LogVol00
44565560 16497340 25768228 40% /
/dev/sda1 101086 16303 79564 18% /boot
tmpfs 521396 0 521396 0% /dev/shm
Thursday, September 5, 2013
P2V Conversion with kernel panic errors.
Assuming that you booted into a rescue CD, did a mkinird(with proper options) command, and still get the kernel panic error. Try this:
Comment out all the existing enties for these hostadapters and add these:
alias scsi_hostadapter mptbase
alias scsi_hostadapter mptspi
alias scsi_hostadapter2 ata_piix
Assuming that you booted into a rescue CD, did a mkinird(with proper options) command, and still get the kernel panic error. Try this:
Comment out all the existing enties for these hostadapters and add these:
alias scsi_hostadapter mptbase
alias scsi_hostadapter mptspi
alias scsi_hostadapter2 ata_piix
Thursday, October 6, 2011
BIOS RAID
Getting this error trying to install a new OS over an old hard drive?
Disk contains BIOS metadata, but is not part of any recognized BIOS RAID sets. Ignoring disk sda
dmraid -r -E /dev/sda
Disk contains BIOS metadata, but is not part of any recognized BIOS RAID sets. Ignoring disk sda
dmraid -r -E /dev/sda
Tuesday, May 3, 2011
Offline uncorrectable sectors
So my task was to figure out what's wrong with a server on a remote site that is still running but no longer accepting file transfer...hmm.
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 90% 2703 1113543272
Device: /dev/sda, 1 Currently unreadable (pending) sectors
Offline uncorrectable sectors
Here is temp fix to get it going while planning to replace the drive.
1. smartctl -l selftest /dev/sda
# 1 Extended offline Completed: read failure 90% 2703 1113543272
2. fdisk -lu /dev/sda
Device Boot Start End Blocks Id System
/dev/sda1 * 63 208844 104391 83 Linux
/dev/sda2 208845 1953520064 976655610 8e Linux LVM
Of course, it has to be /dev/sda2 since the LBA_of_first_error number is within the block range of sda2
Look for Start block # (208845 in my case)Use this formular: ((1113543272-208845)*512)/4096=139166803
3. dd if=/dev/zero of=/dev/mapper/VolGroup00-LogVol00 bs=4096 count=1 seek=139166803
My /dev/sda2 is a LVM drive so I use the mapper volume above. I assume that /dev/sda2 will still work.
Friday, March 18, 2011
Clonezilla Kernel Panic
Clonezilla is nice and all but once in a while, RAID controller differences can make it difficult to boot up the cloned machine. I get kernel panic and the quick fix is to regenerate initrd.
- Use rescue disk
- chroot /home/partimage
- go to /boot
- mkinitrd /boot/initrd-2.6.18-92.el5.img 2.6.18-53.el5PAE (of course, use your kernel version).
That's it. Reboot and you should be able to boot to your cloned machine.
- Use rescue disk
- chroot /home/partimage
- go to /boot
- mkinitrd /boot/initrd-2.6.18-92.el5.img 2.6.18-53.el5PAE (of course, use your kernel version).
- grub-install --recheck /dev/sda (assuming it's sda).
That's it. Reboot and you should be able to boot to your cloned machine.
Wednesday, February 16, 2011
Remove oldest recovery point from DPM
We have Exchange, Sharepoint, and MSSQL in house too, you know?
Today, one of our recovery point partition ran out of space. Normally, I would just log in and increase the disk size. Well, no more space to increase today. I looked and there was no way to delete the oldest recovery point from the GUI...wtf?
DPM Management Shell to the rescue.
$pg=get-protectiongroup -dpmserver server01 #type $pg after this command to see result
$ds=get-datasource -protectiongroup $pg[0] #0 is for the first group from the result of $pg
$rp=get-recoverypoint -datasource $ds #type $rp after this command to see result
remove-recoverypoint $rp[0] #0 is for the oldest recoverypoint from the result of $rp
Not pretty, but it solved my problem.
Today, one of our recovery point partition ran out of space. Normally, I would just log in and increase the disk size. Well, no more space to increase today. I looked and there was no way to delete the oldest recovery point from the GUI...wtf?
DPM Management Shell to the rescue.
$pg=get-protectiongroup -dpmserver server01 #type $pg after this command to see result
$ds=get-datasource -protectiongroup $pg[0] #0 is for the first group from the result of $pg
$rp=get-recoverypoint -datasource $ds #type $rp after this command to see result
remove-recoverypoint $rp[0] #0 is for the oldest recoverypoint from the result of $rp
Not pretty, but it solved my problem.
Subscribe to:
Posts (Atom)