VMware Cloud Community
juchestyle
Commander
Commander

Best Practice way to remove a lun with a vm on it and reattach it to another stand alone esx?

Hey guys, I want to sandbox a vm for performance testing. It is on lun 10, I want to remove the lun and assign it only to a stand alone esx server.

Should I remove the lun from the san fabric only and then attach it to the stand a lone esx.

or

Should I remove the lun from with in virtual center, then from the san fabric and then reattach it?

Respectfully,

Matthew

Kaizen!

Kaizen!
Tags (2)
0 Kudos
25 Replies
kjb007
Immortal
Immortal

If the vm is down and no data is running on it, I've removed from the fabric, and re-attach.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
TomHowarth
Leadership
Leadership

Thread moved to Enterprise Strategy and Planning

Tom Howarth

VMware Communities User Moderator

Blog: www.planetvm.net

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
Erik_Zandboer
Expert
Expert

Hi,

I would do the following:

  1. Stop the VM;

  2. Remove the VM from inventory (NOT from disk);

  3. unzone / mask the LUN from the current ESX hosts;

  4. rescan those hosts, see the LUN disappear;

  5. zone/unmask the LUN to the standalone ESX host;

  6. rescan the standalone ESX host and see the LUN appear;

  7. browse the datastore, find the VMs files and add it to the inventory;

  8. start your refound VM.

This should pose no problem whatsoever...

Visit my blog at http://www.vmdamentals.com
0 Kudos
juchestyle
Commander
Commander

Is it just a rescan, or is it a "Add Storage"

Kaizen!

Kaizen!
0 Kudos
proden20
Hot Shot
Hot Shot

erik's advice is solid, and a rescan should do it.

0 Kudos
RParker
Immortal
Immortal

Is it just a rescan, or is it a "Add Storage"

I have done this many times, and it doesn't have to be removed from the fabric or the Virtual Center. You zone it away from the hosts, rescan, (so no hosts see it) then zone it to the ESX server you want. Done. It's not any more complicated than that.

And yes it's rescan, but I would use esxcfg-rescan not GUI, the GUI tends to hang the server. (at least for us it does)

0 Kudos
proden20
Hot Shot
Hot Shot

OR:

if that is the only vm on the lun just remove your standalone host from the cluster and move the vm to the standalone host. this way drs won't move more vm's to your host. then you could put it back in the cluster and won't have to worry about unmasking luns.

0 Kudos
juchespam
Contributor
Contributor

I am with you. What would happen if I add storage button. Is it going to reformat and wipe everything, or just import it since it is already formated with vmfs?

0 Kudos
proden20
Hot Shot
Hot Shot

i'm not in front of a vmware infrastructure right now, but i think add

storage walks you through setting up a local, iscsi, or nfs

target...what happens when you rescan your fc hba's? as long as your sp is zoned and lun presented to the host on your storage processor, a

rescan of your hba's should pick up the vmfs lun. was this host already seeing the vmfs lun? sometimes it takes more than one rescan.

0 Kudos
juchespam
Contributor
Contributor

Good question. I have never had any luck with a single rescan. So I rescaned two or three times, then I rebooted the esx, then I rescanned two or three more times, I waited, crossed my fingers, refreshed several times, brushed my teeth, but still didn't see the lun in storage. on the adapters page I could see it but not in storage. So I figured it was time to add storage. But when I did that, the vm was gone! Luckily I have a copy out there.

So I am trying to figure out what went wrong. I don't like the idea that a vm dissappeared. The only thing I can think of is the add storage wiped it out.

Ideas?

0 Kudos
kjb007
Immortal
Immortal

I've done this as well. Remove and rezone, rescan. Just good to go.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
proden20
Hot Shot
Hot Shot

no ideas, sounds like you definitely reformatted your lun. i probably would've called support if i knew a lun was formatted with vmfs and my esx host couldn't see it. are all hosts running the same version of esx?

0 Kudos
juchestyle
Commander
Commander

Crap! Yes, when you "Add Storage" It reformats the lun EVEN IF YOU ALREADY HAD IT FORMATTED AS VMFS.

Luckily I made a copy!

Best Practice going forward:

Keep the lun visible on the other esx hosts, add that lun to the new host and wait till you can see everything. Then and only then unmask it away from the other esx hosts.

Thanks for the help gentlemen!

Respectfully,

Matthew

Kaizen!

Kaizen!
0 Kudos
Erik_Zandboer
Expert
Expert

Yep,

It can be tricky. Adding storage will ALWAYS format the LUN. That is why you just rescan (twice is sometimes needed for some reason). When a VMFS is present on a new LUN, it should popup automagically. No "add storage" is neccesary (in fact: don't ever cause this will (re)format !).

Btw, if you choose to "add storage", always check if the "capacity" is equal to "available". That indicates the LUN has no filesystem on it yet. If "available" is equal to "none" then beware; some filesystem is already on it!! This is common for example if you use raw device mapped LUNs; they WILL show up when you start adding storage, but since they are formatted ntfs or ext3 or whatever filesystem, the available capacity shows up as "none" (or at least less than the total capacity).

It can rip up your world in seconds!

Visit my blog at http://erikzandboer.wordpress.com

Visit my blog at http://www.vmdamentals.com
0 Kudos
avlieshout
VMware Employee
VMware Employee

Yep!

Add Storage = Create Partition !!

Just follow Erik's stategy and you will be fine.

Allthough I have seen an ESX server crash on rescanning when a lun was removed (2 times).

Arnim van Lieshout

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
Erik_Zandboer
Expert
Expert

Ouch. Maybe another item should be added "make sure the ESX node is not referencing to the LUN-to-be-removed before masking/unzoning the LUN from the ESX node(s)". I have never seen PSODs because of this myself, but it might help. It is just in cases like this where I like to say "all tested items work". Complex situations like "having some connection to a LUN, then rescanning and seeing that LUN disappear" might very well be untested...

Visit my blog at http://erikzandboer.wordpress.com

Visit my blog at http://www.vmdamentals.com
0 Kudos
avlieshout
VMware Employee
VMware Employee

Erik,

How can I make sure that there are no references to that LUN anymore?

I just recalled that the SVC was having trouble clearing it's cache on that lun last time.

Arnim van Lieshout

blog: http://www.van-lieshout.com

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
donaldmickey
Contributor
Contributor

Hi,

I would do the following:

  1. Stop the VM;

  2. Remove the VM from inventory (NOT from disk);

  3. unzone / mask the LUN from the current ESX hosts;

  4. rescan those hosts, see the LUN disappear;

  5. zone/unmask the LUN to the standalone ESX host;

  6. Change LVM.EnableResignature : 1

  7. rescan the standalone ESX host and see the LUN appear;

  8. browse the datastore, find the VMs files and add it to the inventory;

  9. start your refound VM.

:smileygrin:

0 Kudos
Erik_Zandboer
Expert
Expert

And you would do this why? This will resignature ALL LUNs and could generate a heap of trouble without any gain in my opinion.... Can you explain why you would go and resignature??

Visit my blog at http://erikzandboer.wordpress.com

Visit my blog at http://www.vmdamentals.com
0 Kudos