VMware Cloud Community
denisesballs
Contributor
Contributor
Jump to solution

Script erased on reboot

Hello all,

Not sure if anyone knows about 3ware cards, but they require installing the driver after install in order to work. 3ware also provides a customized version of their array configuration utility "tw_cli" that works on ESXi - http://3ware.com/KB/article.aspx?id=15600

Anyways, it works great and all, but I noticed on every reboot reboot the tw_cli binary I copied to / on the ESXi server gets erased. I've tried leaving it in root's home (/) and also putting it in root's $PATHs (/bin,/sbin), but every time I reboot it gets erased. I want to make sure it stays on there so I can always check my RAID status and also so I can write a nagios plugin to monitor it. The only other thing I can think of is copying it to the datastore, but I'd rather know what's going on and have it in the root filesystem. Any ideas? TIA -Jesse

0 Kudos
1 Solution

Accepted Solutions
marcelo_soares
Champion
Champion
Jump to solution

Try this way:

cd /

mkdir test

cp -r YOURFILE_GOES_HERE /test

cp /bootbank/oem.tgz /test

cd test

tar -xzvf oem.tgz

rm oem.tgz

tar -czvf oem.tgz 'YOUR_FILE_HERE_AGAIN' 'FILE_CREATED_WITH_TAR'

mv oem.tgz /bootbank

cd ..

rm -r test

I tested here and the file were present for me after reboot.

Marcelo Soares

VMWare Certified Professional 310/410

Technical Support Engineer

Globant Argentina

Consider awarding points for "helpful" and/or "correct" answers.

Marcelo Soares

View solution in original post

0 Kudos
7 Replies
marcelo_soares
Champion
Champion
Jump to solution

ESXi have a ramdisk (that is loaded everytime you power ESX on), so everything you keep on the / will be deleted. Try placing the script at the VMFS folder. "/vmfs/volumes/".

Also, you can try (by your responsability):

cd /

mkdir test

cp -r YOURFILE_GOES_HERE /test

cp /bootbank/oem.tgz /test

cd test

tar -xzvf oem.tgz

rm oem.tgz

tar -czvf oem.tgz 'YOUR_FILE_HERE_AGAIN' 'etc' 'lib' 'sbin' 'usr' 'var' pkgdb.tgz

mv oem.tgz /bootbank

cd ..

rm -r test

Good luck.

Marcelo Soares

VMWare Certified Professional 310/410

Technical Support Engineer

Globant Argentina

Consider awarding points for "helpful" and/or "correct" answers.

Marcelo Soares
denisesballs
Contributor
Contributor
Jump to solution

Hey Marcelo, thanks for the reply.

I want to try the custom oem.tgz method you've suggested but I think you have a typo in there.

I make /test, copy my file 'tw_cli' to there. I copy /bootbank/oem.tgz to /test. When I extract it (tar -xzvf oem.tgz), the only file extracted is called '.emptytgz' which is blank. Then trying the create command, I get nothing:

/test # tar -czvf oem.tgz 'tw_cli' 'etc' 'lib' 'sbin' 'usr' 'var' pkgdb.tgz

tw_cli

tar: etc: No such file or directory

tar: lib: No such file or directory

tar: sbin: No such file or directory

tar: usr: No such file or directory

tar: var: No such file or directory

tar: pkgdb.tgz: No such file or directory

tar: error exit delayed from previous errors

Should those be /etc, /lib etc. (instead of 'etc' 'lib')? What about / (root)? Where is pkgdb.tgz supposed to come from? Thanks again.

(looking again I think I'm supposed to cd / before I create the tgz since that's where the directories and pkgdb.tgz are but what about opt, vmiages etc?)

0 Kudos
marcelo_soares
Champion
Champion
Jump to solution

Weird, it should have all the / contents on it.

I will do it on my u1 lab again (I did it sometime ago with passwordless SSH with dropbear) and post results here. Maybe I am forgetting something.

Marcelo Soares

VMWare Certified Professional 310/410

Technical Support Engineer

Globant Argentina

Consider awarding points for "helpful" and/or "correct" answers.

Marcelo Soares
0 Kudos
Texiwill
Leadership
Leadership
Jump to solution

Hello,

Moved to ESXi forum.

Also, instead of the OEM route you can place the file on any /vmfs used for VMs. Perhaps make a 'script' directory under there and reference the tw_cli from within that. However, the oem.tgz route is the best way.


Best regards,
Edward L. Haletky VMware Communities User Moderator, VMware vExpert 2009

Now Available: 'VMware vSphere(TM) and Virtual Infrastructure Security'[/url]

Also available 'VMWare ESX Server in the Enterprise'[/url]

Blogging: The Virtualization Practice[/url]|Blue Gears[/url]|TechTarget[/url]|Network World[/url]

Podcast: Virtualization Security Round Table Podcast[/url]|Twitter: Texiwll[/url]

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
denisesballs
Contributor
Contributor
Jump to solution

That would be great Marcelo because I'm going to be doing the same thing with mine, passwordless SSH. I don't see why my oem.tar.gz only contains an empty file called .emptytgz.

0 Kudos
marcelo_soares
Champion
Champion
Jump to solution

Try this way:

cd /

mkdir test

cp -r YOURFILE_GOES_HERE /test

cp /bootbank/oem.tgz /test

cd test

tar -xzvf oem.tgz

rm oem.tgz

tar -czvf oem.tgz 'YOUR_FILE_HERE_AGAIN' 'FILE_CREATED_WITH_TAR'

mv oem.tgz /bootbank

cd ..

rm -r test

I tested here and the file were present for me after reboot.

Marcelo Soares

VMWare Certified Professional 310/410

Technical Support Engineer

Globant Argentina

Consider awarding points for "helpful" and/or "correct" answers.

Marcelo Soares
0 Kudos
denisesballs
Contributor
Contributor
Jump to solution

Marcelo, that works perfectly! Even with the ssh folder I created. Thanks a ton!

0 Kudos