Monday, February 6, 2012

CHROOT to remote fedora 16 install on SAN via iscsiadm

The goal of this post is to help you gain access to a CHROOT environment of a F16 install which was installed to a SAN via iscsi.

While working on installing fedora to a diskless system using iscsi root and boot, my system would not boot. I needed a way to access the system in chroot so I could reinstall grub with the proper iscsi boot config. Everything discussed here is Fedora 16 64bit. I am using an EMC VNXe 3100 SAN. For this demonstration, I do not have chap enabled so it is not discussed here.

Boot the Fedora 16 Live CD USB
  • Boot Fedora 16 Live USB. I had some problems getting mine to boot so see blog entry http://ispman.blogspot.com/2012/02/boot-fedora-16-64-bit-live-boot-from.html
  • Open a terminal window and su
Connect to the SAN via iSCSI using iscsiadm
  • Edit /etc/iscsi/initiatorname.iscsi and put in the iqn your machine is going to initiate iscsi as. In my case: InitiatorName=iqn.1986-03.com.ibm:06LEJE8.linux Note: The initiator name also needs programmed in your SAN to allow connections from the IQN.
  • Reload iscsi:
#/etc/init.d/iscsi restart
  • Setup your ethernet card to have an IP on the SAN network:
# ifconfig eth0 172.16.10.100/24
  • Add the network card you are going to use for iscsi to the iscsi database:
# iscsiadm -m iface -I eth0 -o new
New interface eth0 added
  • Add the iscsi target to your isci database using iscsiadm: iscsiadm -m node -T -p -o new
# iscsiadm -m node -T iqn.1992-05.com.emc:apm001140005820000-10-vnxe -p 172.16.10.18 -o new

Starting iscsid:

New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] 172.16.10.18,3260,-1 iqn.1992-05.com.emc:ap001140005820000-10-vnxe] added
  • Now log into the iscsi target: iscsiadm -m node -T -p -l

# iscsiadm -m node -T iqn.1992-05.com.emc:ap001140005820000-10-vnxe -p 172.16.10.18 -l

Logging in to [iface: default, target: iqn.1992-05.com.emc:apm00114005820000-10-vnxe, portal: {172.16.10.18,3260]

Login to [iface: default, target: iqn.1992-05.com.emc:apm00114005820000-10-vnxe, portal: {172.16.10.18,3260] successful

  • Ensure the session is up and running

# iscsiadm -m session -P 3

  • Using dmesg, find what device your iscsi drive was attached to. In my case it was sdb
  • I used LVM when I installed to the iscsi target before so I have to bring up the lv's

#fdisk -l /dev/sdb

  • Use lvs to find the VG name

#lvs

  • Make the lv active

#vgchange -a y VolGroup

  • Make your temporary mountpoint

#mkdir /mnt/sysimage

  • Mount the root partition to sysimage. For me, lvs told me the name was lv_root, then mount the rest

#mount /dev/VolGroup/lv_root /mnt/sysimage

#mount -t tmpfs none /mnt/sysimage/tmp

#mount -t tmpfs none /mnt/sysimage/var/lock

#mount -t tmpfs none /mnt/sysimage/var/lib/iscsi

#mount --bind /dev /mnt/sysimage/dev

#mount -t proc none /mnt/sysimage/proc

  • Mount the boot partition of the drive which for me was sdb2

#mount /dev/sdb2 /mnt/sysimage/boot

  • Begin the chroot

#chroot /mnt/sysimage

#source /etc/profile


Boot Fedora 16 64 bit live boot from usb ibm hs22

I was not able to boot to a Fedora 64bit live usb stick. I downloaded the 64bit live iso and used the windows version of Fedora Live USB Created. The boot would drop out saying no root device.


From: http://www.fedoraforum.org/forum/showthread.php?p=1476942


nk1eto Offline
Registered User
Join Date: May 2011
Posts: 1
linuxfirefox
Re: Lenovo S205 won't boot any Live USB Fedora distro

I was having this same exact problem on a Lenovo x120e Thinkpad, Fedora liveUSB created with unetbootin. Solved it by:

1. Find your USB disk label. When in the debug shell, run
Code:
ls /dev/disk/by-label/ UDISK
My label was UDISK. The fedora installer by default expects the label to be Fedora-15-x86_64-Live-Desktop (or similar)
2. Reboot and edit the GRUB boot command.
Code:
hit ENTER to view GRUB menu. hit 'e' to edit commands before booting. hit 'e' to edit top entry. change LABEL=Fedora-15-x86_64-Live-Desktop to LABEL= (also remove 'quiet rhgb' for verbosity) hit ENTER to accept and 'b' to boot.
that should do it.

Last edited by nk1eto; 28th May 2011 at 03:23 PM.

Tuesday, January 10, 2012

Specify different network policies for different ssid's on a single cisco ap

From looking at the log file for NPS (to find your log file go to server manager, roles, network policy and access services, NPS, Accounting) I was able to see that when I connect to different ssids (single cisco access point, multiple ssids and vlans), the log shows me the mac address of the virtual ap I connect to. I tried to find this mac address on my cisco ap but couldnt so I connected to the different ssid's, looked at the log to get them.

For example:
"VMDC01","IAS",01/10/2012,10:00:41,1,"seegrid\bfisk","SEEGRID\bfisk","0023.050c.e751","0811.9688.ffb0",,,"pghap2","192.168.10.25",51105,9,"192.168.10.25","pghap02",,,19,,,1,11,"SGA Wireless",0,"311 1 192.168.10.4 01/10/2012 13:30:09 192",,,,"Microsoft: Secured password (EAP-MSCHAP v2)",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"SGA",1,,,,

After my username bfisk, you will see the mac for the vap and for my client computer connecting to the wifi. Looking at the logs I found one ssid = e751 and the other was e750.

I then created network policies, one for each ssid/vlan and used the condition Called Station ID = e751$ for the one ssid, e750$ for the other ssid. Added the different domain group conditions for each and presto, working like a champ.

Downfall to this is if you have multple ap's you will need to do the same for each ap to get all the mac addresses. I couldnt find the vap mac using show int.

Tuesday, November 23, 2010

Received Error: 452 4.4.2 Mailbox Full Microsoft SMTP Virtual Server (Server 2008r2)

Emails were bouncing back to a sharepoint list of mine. After further digging I found out there is a little switch in the smtp server setup that puts a quote on a mailbox. I recommend removing this for anyone accepting email into email enabled lists in sharepoint.

Here was the message I was receiving from my exchange server (which forward mail addressed to @sharepoint.seegrid.company to the sharepoint smtp server):

Delivery is delayed to these recipients or groups:

fieldstatus@sharepoint.seegrid.company (fieldstatus@sharepoint.seegrid.company)

Subject: FW: test

This message hasn't been delivered yet. Delivery will continue to be attempted.

The server will keep trying to deliver this message for the next 1 days, 19 hours and 59 minutes. You'll be notified if the message can't be delivered by that time.


So I telnetted to the sharepoint server running the built in Microsoft SMTP Server that comes with Windows Server 2008 R2 and go the following error:

220 sharepoint.seegrid.company Microsoft ESMTP MAIL Service, Version: 7.5.7600.1
6544 ready at Tue, 23 Nov 2010 14:42:17 -0500
ehlo
250-sharepoint.seegrid.company Hello [192.168.10.89]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250 OK
mail from: bfisk@seegrid.com
250 2.1.0 bfisk@seegrid.com....Sender OK
rcpt to: fieldstatus@sharepoint.seegrid.company
452 4.2.2 Mailbox full

After searching around I found the following at: http://www.dawkco.com/software/support/sir200212191418.txt

Disable the SMTP Drop Directory Quota setting
=============================================
1. Open Internet Services Manager
a. Expand the local computer node
b. Expand SMTP Virtual Server node
c. Select the Domains node under the SMTP Virtual Server node
2. In the right-hand pane, Right-click on the Local (Default) domain name
in the list of domains
a. Select Properties
b. CLEAR the "Enable drop directory quota" checkbox
c. Click OK
3. Stop, and then re-Start the SMTP Virtual Server to force the change to
take effect immediately.

Wednesday, November 10, 2010

Restoring an exchange 2010 mailbox using DPM 2010

Overview:

DPM server backs up exchange server database every morning at 1am. We had to recover a user mailbox from the week before. DPM uses VSS writer to backup the exchange database. This means even when you want to restore a single mailbox, DPM will restore the entire mailbox database for the date you choose to an exchange recovery database and then you pull out that users data. The instructions below assume only that you already have DPM setup and backing up your exchange server.

My setup:

Primary VM Server:
  • Windows server 2008 R2 enterprise
  • Dual quad 3ghz xeon ibm x3550
  • 48gb ram
  • 2 750gb drives raid 0 which are c: and d: drive
  • c: is os, d: is virtual memory for server
  • 4 1tb drives raid 5 which is e: drive
  • 4 active windows server 2008 r2 virtual machines with virtual hard drives on e:

Exchange VM:

  • 16gb ram
  • 300gb virtual hard disk (c:)
  • 150gb virtual hard disk (d:)

DPM Server:

  • Windows server 2008 r2
  • DPM 2010
  • Single core2duo 2.8ghz
  • 8gb ram
  • 2 1tb drives raid0 (c: os)
  • 16tb drobo connected via gigabit eth (backup destination)

Backup schedule:

  • Backup exchange database every morning at 8am

The Process:

  1. Using exchange powershell, create a recovery database on your exchange server. Make sure you create the database on a drive where you will have enough space to recover the entire mailbox database backup. In my case, my mailbox database was 80gb. You only have to create a recovery database once. You can use it over and over again for your restore. Syntax: new-mailboxdatabase -Recovery -Name RDB1 -Server vmexchange01 -EDBFilePath "d:\rdb1\database\rdb1.edb" -LogFolderPath "d:\rdb1\Logs"
  2. Set the database so it can be overwritten. You will need to do this everytime before you go to recover a mailbox as once the recovery is done, the flag will be removed automatically. Syntax: set-mailboxdatabase -Identity rdb1 -AllowFileRestore 1
  3. Open DPM Console, select the Recovery tab
  4. Select the exchange database, the date you wish to recover from
  5. Right click on the mailbox you wish to recover and choose recover
  6. Confirm that you are recovering the correct mailbox and date and click Next
  7. Choose Recover mailbox to an Exchange server database and click Next
  8. Enter in your exchange server, in my case it is vmexchange01 and specify the database name, in my case, RDB1
  9. Uncheck SAN Recovery, set a notification for when the restore is complete, click Next
  10. Confirm the settings and click Next
  11. The restore is now in progress. You can close the status window if you wish and monitor through the Monitoring tab
  12. You will notice that DPM will start recovering the entire mailbox database for the date you specified to you recovery database on the exchange server. As soon as you see some data transferred, the size of the recover database on the server be set to the size of the recovery. This will help you gauge how long the recover will take
  13. Once the recovery is complete, you will then need to transfer the users recovered mailbox to an active user on the exchange server. In my case, I am going to recover the mailbox of "Brian Fisk" to a folder called "Recovered Backup" under the exchange user ittest. THIS WILL NOT OVERWRITE THEIR MAILBOX, it will add a folder at the same level as Inbox called Recovered Backup
  14. Syntax: New-MailboxRestoreRequest -SourceDatabase "rdb1" -SourceStoreMailbox 'Brian Fisk' -TargetMailbox ittest@seegrid.com -TargetRootFolder 'Recovered Backup' -AllowLegacyDNMismatch
  15. When prompted, hit Y to recover the mailbox
  16. You will now see a folder called 'Recovered Backup' under the mailbox

Thursday, May 21, 2009

Resizing LVM Volumes in Linux under vmware or native

This is a great set of instructions by David Maphis on how to resize an LVM volume in Linux. I just used these instructions to expand my linux virtual machine hard drive under vmware fusion. OS was Fedora core 6 using lvm. Vmware I used was VMware fusion for the mac but this applies to any linux system using lvm.

Under my vm settings in VMware fusion I expanded the disk to be larger and then followed these instructions for the linux side of things. Obviously the vm has to be shutdown before you mess with the hd size in vmware but all of the linux steps I did on the live system within Xwindows. LV's are great!

Here are David's instructions. You can skip his intro if you are not using vmware server. I injected some notes which you will find in bold.

URL to original pdf: http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fcommunities.vmware.co
Publish Post
m%2Fservlet%2FJiveServlet%2FpreviewBody%2F4900-102-2-3019%2FResizing%2520LVM%2520Volumes%2520in%2520Linux.pdf%3Bjsessionid%3D9DC6B8A9615CEBD28FE94412BA638CE1&ei=VJcVSsioAZio8gSaxKjHAg&usg=AFQjCNGSDpxwdH7ojtEpCwiGR_Yueod_Kg&sig2=oJ4vPtV31iEBovG4xMFuHw

By David Maphis 4/29/2008

In this example I will changed the size of my root partition without
affecting any data. Since this is a VM, I can extend my vmdk with the
“vmkfstools” command. To do this I will have to shutdown the VM to release
the lock on the file then resize it. Power up when complete.

Once this is done, make a partition that uses the available space you wish to
add to the LVM volume using “parted”. It has an interactive shell, so just
enter “parted” in a shell:

parted
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 206MB 206MB primary ext3 boot
2 206MB 8587MB 8382MB primary lvm


So I have from 8588MB to 10.7GB available for a new partition. For this
example I’m only using up to 9588MB. Your numbers will obviously vary.

So now let’s make a partition from the new space:

(parted) mkpart primary 8588 9588

(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 206MB 206MB primary ext3 boot
2 206MB 8587MB 8382MB primary lvm
3 8587MB 9588MB 1001MB primary

You can now see that we have allocated a total of 1001MB of space to
partition 3 or /dev/sda3.

Next we need to create a Physical Volume (PV) with “pvcreate”. LVM also has
an interactive shell, so type “lvm” in a shell prompt:

lvm
lvm> pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created

lvm> pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 7.78G 32.00M
/dev/sda3 lvm2 -- 954.44M 954.44M

BFISK NOTE: I did not see sda3 when I ran the pvs command but I was able to proceed with the directions.

Now there is a partition that is about 1GB of space available on PV
/dev/sda3.

Now we need to extend the Volume Group (VG) to include the new PV with the
“vgextend” command:

lvm> vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
lvm> pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 7.78G 32.00M
/dev/sda3 VolGroup00 lvm2 a- 928.00M 928.00M

BFISK NOTE: I dont think I saw sda3 here either but continued with directions

By virtue of the fact that we used the same name as the existing VG, we have
now included this PV in the VG.

Extend the Logical Volume (LV) to include the new space with “lvextend”. To
determine that size of the extents we want to add, we first need to view the
VG:

lvm> vgdisplay VolGroup00
--- 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 8.69 GB
PE Size 32.00 MB
Total PE 278
Alloc PE / Size 248 / 7.75 GB
Free PE / Size 30 / 960.00 MB
VG UUID Ll4Bg4-jIFV-lfut-z4Ae-JTfH-0Hzp-Zf9RjM

Looking at this we can see that the total “Free PE” is 30. We will use this
in the following command:

lvm> lvextend -l+30 /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 8.19 GB
Logical volume LogVol00 successfully resized

BFISK NOTE: I am not sure what the +30 is. It's not MB and it's not GB. Maybe %? I dunno, I just issued the command until it told me there was no space left. At that point I used -l+10 untill I ran out and then +1, etc until I had no empty space left.

lvm> lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-ao 8.19G
LogVol01 VolGroup00 -wi-ao 512.00M

So there you are, you have now extended your LV. Now we have to clue the OS
in what is happening.
We need to expand the file system to make the new space visible to the OS
with resize2fs (Fedora, CentOS) or ext2online (RedHat)

[root@labserver02 dev]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.1G 1.3G 5.4G 20% /

[root@labserver02 dev]# resize2fs
resize2fs 1.40.2 (12-Jul-2007)
Usage: resize2fs [-d debug_flags] [-f] [-F] [-p] device [new_size]

[root@labserver02 dev]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.40.2 (12-Jul-2007)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing
required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2146304 (4k)
blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2146304 blocks long.

[root@labserver02 dev]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
8.0G 1.3G 6.3G 17% /

Wednesday, May 13, 2009

Xen: Move an LVM-based virtual machine to another host without shared storage between the two hosts

For those running Xen on servers with no back-end SAN, the following instructions detail the steps necessary to move an LVM-based virtual machine to a new physical host. There may be more elegant ways to achieve this, but this is what worked for me.

Environment
Ok, so let’s set the scene:

  • vmhost is a RHEL 5 server running several virtual machines using the Xen virtualization technology. Each virtual machine is allocated a 60 GB logical volume within an LVM volume group. One of these virtual machines, “win2k3vm”, needs to be moved to a new server.
  • new-vmhost is almost identical to vmhost, but has updated hardware and more memory. This is the server that “win2k3vm” will be moved to.


Migrate the Virtual Machine
1. Create a snapshot of virtual machine LVM volume. This can be run on a live virtual machine, but it is probably safer to perform a graceful shutdown of your virtual machine first.

[root@vmhost]# lvcreate -s -L 300m -n win2k3vm-snap VolGroup01

2. Export the snapshot of the guest VM to a file that can be moved between physical servers.

[root@vmhost]# dd if=/dev/VolGroup01/win2k3vm-snap of=/mnt/temp/win2k3vm.img bs=4096

3. Remove the snapshot LVM volume.

[root@vmhost]# lvremove /dev/VolGroup01/win2k3vm-snap

4. Copy the file to the new VM host. Make sure you have sufficient free drive space.

[root@vmhost]# scp /mnt/temp/win2k3vm.img user@new-vmhost:/mnt/temp/

5. On the new VM host, create an LVM volume that is at least as big as the guest VM file.

[root@new-vmhost]# lvcreate -n win2k3vm -L 60G VMGroup

6. Transfer the guest VM file to the new LVM volume.

[root@new-vmhost]# dd if=win2k3vm.img of=/dev/VMGroup/win2k3vm bs=4096

7. Copy the VM config file from the old VM host to the new VM host server.

[root@vmhost]# scp /etc/xen/win2k3vm user@new-vmhost:

8. Copy the file to the appropriate directory.

[usr@new-vmhost]$ sudo mv ~/win2k3vm /etc/xen/

Summary of Commands
[root@vmhost]# lvcreate -s -L 300m -n win2k3vm-snap VolGroup01
[root@vmhost]# dd if=/dev/VolGroup01/win2k3vm-snap of=/mnt/temp/win2k3vm.img bs=4096
[root@vmhost]# lvremove /dev/VolGroup01/win2k3vm-snap
[root@vmhost]# scp /mnt/temp/win2k3vm.img user@new-vmhost:/mnt/temp/
[root@new-vmhost]# lvcreate -n win2k3vm -L 60G VMGroup
[root@new-vmhost]# dd if=win2k3vm.img of=/dev/VMGroup/win2k3vm bs=4096
[root@vmhost]# scp /etc/xen/win2k3vm user@new-vmhost:
[usr@new-vmhost]$ sudo mv ~/win2k3vm /etc/xen/



Credit goes to: http://www.alethe.com/brad/2008/04/move-an-lvm-based-virtual-machine-to-another-host/ who these instructions were created by.

These instructions were perfect. Thanks Brad!