Ive been spending a lot of time in the last year and a half dealing with Apache Tomcat. The DevOps team I am on focuses on Grails for almost all development needs. We use Tomcat 6 and 7 to host a variety of applications we have written. As such I have learned a lot about Tomcat, and Im going to use this opportunity to share some of the things I have learned with you.
The server setup
I like using CentOS on my personal stuff, so for this example Ill be using CentOS 6.3 and using my Rackspace Cloud Server. Im just using the default image provided by Rackspace. From the cloud server control panel I name my server tomcat-dev1. Next I selected CentOS 6.3 for the image and 512M of RAM for the server size. Finally in the networks section I leave it defaulted to a public and private adapter, and then press the create server button to begin building my new cloud server. Keep in mind this is just a development server for me so I dont need much RAM, for a production system you will need to calculate your needs accordingly and make your server as large as you need it. Once my server is done building I will log on and install:
- jdk 7 from Oracle
- Tomcat 7
- git (optional, but I like to keep my config files in version control)
- jsvc (this is bundled with tomcat)
Lets begin by logging into our new cloud server as root. The first thing I do to a new cloud server is change the password. Once that is done we can begin by updating the system.
yum -y update
This is done because the base image could be several months old so we want to get the latest updates from the vendor before we begin. Once that finishes reboot if you need, if you do not know if you need a reboot or not just do it anyway to be sure.
Gathering the goods
Some of what we will be installing is either not provided by yum, or is older and we want flashy and new. We need to fetch the jdk; I will download the x64 rpm to my local desktop then upload it to my cloud server using winscp. Next we need Tomcat, and jsvc. Since these two things do not require me agreeing to some terms I will download them directly from the server.
Now on my server I should have the jdk rpm, and the Tomcat 7, and jsvc packages.(jsvc is bundled with tomcat)
Installing the jdk, Tomcat, and jsvc
We need to install the jdk first. To do that lets install the rpm:
rpm -Uvh jdk-7u10-linux-x64.rpm
If you see output like this:
Error: Could not open input file: /usr/java/jdk1.7.0_10/jre/lib/rt.pack
Error: Could not open input file: /usr/java/jdk1.7.0_10/jre/lib/jsse.pack
Error: Could not open input file: /usr/java/jdk1.7.0_10/jre/lib/charsets.pack
Error: Could not open input file: /usr/java/jdk1.7.0_10/lib/tools.pack
Error: Could not open input file: /usr/java/jdk1.7.0_10/jre/lib/ext/localedata.pack
It is safe to ignore.
I didnt dig into why this output happened but it did not seem to affect my install. Now that Java is installed we need to add the java install to the alternatives system, and make it so that the JAVA_HOME environment variable is set for all our users when they log in. Lets do that by creating a file in /etc/profile.d called java.sh Using your favorite text editor create the file /etc/profile.d/java.sh and enter the following lines into the file and then save it:
Now the file needs to be set executable so issue the following command:
chmod +x /etc/profile.d/java.sh
Now to add java to the alternatives system
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
Lets test that this works by typing:
Right now we should get no output. Now try logging off our server, and logging back in. Once you do that type the command again. We should now see:
Now we need to unpack Tomcat, and the jsvc daemon.
tar xzvf apache-tomcat-7.0.34.tar.gz -C /opt/
This will unpack Tomcat into the /opt directory into a folder named apache-tomcat-7.0.34 Once that is done unpack the commons-daemon source code. That code is bundled with tomcat:
tar xzvf commons-daemon-native.tar.gz -C /usr/local/src/
The source code for the jsvc daemon is now in /usr/local/src/commons-daemon-1.0.10-native-src and needs to be built. Before we can build it we still need to install a couple of things on our server. According to the docs we need a compiler, and make. In an effort to make it simple I will be using yum and the groupinstall option to install “Development tools” This will provide git, make, gcc, cpp, and many other tools.
yum -y groupinstall "Development tools"
Once that is complete we have what we need to build jsvc, so lets do that now. Since we are using CentOS we will want to:
From here we can issue the configure command:
This should render some output, the last thing it says if you were successful is this:
*** All done ***
Now you can issue “make”
Lets do that now.
If you got no errors you should now have a binary file in the same directory as you called jsvc. Since this Makefile does not have a target for install the next natural step of make install would fail. You have to manually place the binary somewhere on your system. I like to just put it with the tomcat binaries since thats the only thing I use jsvc for, so thats what Ill do now:
cp jsvc /opt/apache-tomcat-7.0.34/bin/
You should now have Java 7, Tomcat 7, and jsvc 1.0.10 installed on your system. We are getting close to being done. Only a few more steps left!!
Doing some Tomcat configuration, and making Tomcat start at boot
Now that we have all these things installed we need to do some configuration, and also make it so Tomcat will start when the system boots up. Lets begin with making tomcat start at boot. Im going to provide you with the init script I wrote and use on my systems. You can get the latest version from here. Download it and save the file in /etc/init.d as tomcat
wget https://raw.github.com/michaelrice/tomcat_files/master/init.d/tomcat -O /etc/init.d/tomcat
This file needs to be executable so lets issue the following command:
chmod +x /etc/init.d/tomcat
Now we need to make sure tomcat will start at boot:
chkconfig --add tomcat && chkconfig tomcat on
This will add tomcat to the chkconfig system, and enable it for start up on boot. Lets take a look at what this file does for us. On line 4 we see this:
# chkconfig: – 85 15
This is needed for chkconfig so our command above would work. For more information see man chkconfig. Scroll down in the file until you see:
This is where the user that tomcat will run as is defined. By default it wants to run as the user named tomcat. We have not created that user yet, but we will shortly. The next two things to notice are right below the TOMCAT_USER line.
These locations on the file system are not there by default so we need to add them, and make sure our tomcat user has access to them, but lets keep looking through this file for now and we will fix all the things at once. Lets scroll down to lines 20 and 21
[ -f /etc/profile.d/tomcat.sh ] && . /etc/profile.d/tomcat.sh
[ -f /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
This is checking to see if these files exist and if so source them, this will set up our environment variables for us. The tomcat file is missing still, but we will add it soon. I think one of the last things to note here in this file is the JSVC_BIN variable. If you put jsvc in some other location than where I put it then you need to adjust this to your location. Finally on line 62 we have the command we use to start tomcat. You should not need to adjust this, but if you need to thats where to do it. Now that we know what this file will do for us, lets fix all the things we found while going through it.
Finializing the Tomcat bits
The first problem we found above was our script is looking for a “tomcat” user and we dont have one yet, so lets add one:
useradd -r tomcat -m
This added a new system user named tomcat, and created a group also named tomcat. A home dir was created in /home/tomcat The next problem we found was that a couple of files need to be created, and our tomcat user needs access to them. Lets make it happen:
mkdir -p /var/lock/subsys/tomcat/
mkdir -p /var/run/tomcat/
chown -R tomcat. /var/run/tomcat
chown -R tomcat. /var/lock/subsys/tomcat
Finally the tomcat.sh file needs to be created and make executable. Using your favorite text editor create the file /etc/profile.d/tomcat.sh and add the following to it, then save it:
Now we need to make it executable:
chmod +x /etc/profile.d/tomcat.sh
You may have noticed that the location of CATALINA_HOME and CATALINA_TMPDIR dont exist on our server, good catch. I use symlinks to this. Lets get them created.
ln -s /opt/apache-tomcat-7.0.34/ /opt/tomcat
I do this so if I update tomcat I only have to update this symlink and do not have to edit my init script, or my profile.d script. Now all we have left for tomcat is to make sure we have the server.xml file created correctly, and if we want to allow access to the manager we need to make a tomcat-users.xml file as well. I have provided the server.xml and the tomcat-users.xml file I used here. Those files need to be saved in /opt/tomcat/conf/ as server.xml and tomcat-users.xml Once you have done that you should be able to start tomcat, so lets try that now.
service tomcat start
Lets verify its running:
We should see some output like the following:
[root@tomcat-demo unix]# ss -nap
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 ::ffff:127.0.0.1:8009 :::* users:((“jsvc”,20103,39))
LISTEN 0 100 ::ffff:127.0.0.1:8080 :::* users:((“jsvc”,20103,38))
This shows us that jsvc has a process listening on port 8009 and 8080, on the local loop back interface only, just like we setup in our config file. This is wonderful now we are done with tomcat for now. Lets move on to httpd and setting up the ajp.
Apache httpd and mod_proxy_ajp
We need to install httpd now.
yum -y install httpd && chkconfig httpd on
We do not need to do anything to get mod_proxy_ajp it is part of the base httpd install as of 2.2. Now that our web server is installed lets configure our first vhost, and serve up some tomcat content. Using your favorite text editor open the httpd.conf file located at /etc/httpd/conf/httpd.conf The vhost section is at the bottom of the file by default. In my case I added the following:
Allow from all
ProxyPass / ajp://localhost:8009/
Next I need to open port 80 on my firewall, since the default firewall will be blocking traffic on port 80. Using my text editor I will edit /etc/sysconfig/iptables so it looks like so:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
Next I need to load this new rule set like so:
iptables-restore < /etc/sysconfig/iptables
Now I am done, and Im ready to fire up httpd and visit my site.
service httpd start
You can now visit your site in a browser and see the default Tomcat landing page, as well as add a /manager and log in using "tomcat" as the user, and "s3cret" as your password. In the coming weeks I will be adding more info about how to do vhosting using this method, and eventually covering how to do this all in a few mins using chef
Ive been doing a fair bit of work around the vmware vix api. One of the things I needed to do was run sysprep after a clone is taken, and beofre the vm is brought on to the network and rejoined to AD. I decided to use vix to do it. Getting the command to run using vix is simple enough with VMRunProgramInGuest(). The issue I ran into was with the parameters I was passing to sysprep.exe
Sysprep will log into:
In those files is where I found the error:
SYSPRP Parse Commands:No action flag was specified
I was leaving off the Action flag clearly, but what are valid Actions? It wasnt clear to me until I ran sysprep with out any command line args and saw the gui. Then you can see that oobe and audit are your 2 options. oobe best fit my needs. Once I added that my error was corrected and sysprep would successfully run
Just a quick post. If you are running Debian 6 as a virtual machine and want to get the vmware tools installed in the vm its pretty simple. I recommend using the open-vm-tools package (I recommend using these for ALL Linux distros). In Debian 6 this package is provided in the contrib repo. To enable access to this repo you simply edit (as root or sudo) your /etc/apt/sources.list file and add contrib to it like so:
deb http://ftp.us.debian.org/debian/ squeeze main contrib
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib
deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib
# squeeze-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ squeeze-updates main
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main
Once you save, still as root or sudo simply run:
Once it finishes you can run:
apt-get install open-vm-tools.
Thats all there is to it.
DANGER!! Please note this will likely null and void any kind of warranty or support you may have on your vma, and it will also break vima-update depending on what you allow yum yo update, it might even cause the world to explode.. I dont know and Im not responsible for anything that goes wrong following this..
With that out of the way.. So you want to install yum on your vma so you can install some packages on your vma, and you dont want to track down rpms for it.. I had the same desire. Here is how I took care of the problem.. First I found that /etc/redhat-release stated I was using a Red Hat Enterprise Linux Server release 5.2 (Tikanga). Once I found this out I decided to use CentOS mirrors to get me a copy of yum and to update rpm and such so I could have yum.
First the base vma is missing some stuff in order to just grab yum and start using it. I found mine to be missing python-initparse, yum-fastestmirror, and yum-metadata-parser. For me I got a root shell using sudo -s, next I ran the following command from my root shell:
# rpm -Uvh http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
This installed yum and the missing libs I needed to use it. Next I had to create a yum.conf repo file that the system can use to pull packages from. I used the following:
# Note: yum-RHN-plugin doesn't honor this.
installonly_limit = 5
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
name=CentOS-5.2 - Base
name=CentOS-5.2 - Updates
Please note the repo info like the file states can be added to a .repo file if you want, but to shorten this for me Im doing it all in 1 place. I would also suggest going though and adding things like kernel* to the excludes= section (that is really beyond what Im trying to cover here though). Once you have this minimal info in your file you can save it. Next you need to import the RPM-GPG-KEY so you can install files.. As root:
rpm --import http://mirror.centos.org/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
Now you can update things like rpm, or even install vim-common or emacs You could also go a step further and install the epel repo and then install puppet so if you are in a large scale environment you can keep the system updated and files in sync with all your other hosts.
For almost the last year I have been working heavily with vSphere automation. Recently I have found that there is a way to do a lot of the tasks with Python, taking advantage of a fairly newish python library called psphere. I have created a github project where I am keeping tools I make outside of work. These tools do common tasks that administrators and engineers who manage small and large scale environments might find useful.. Its a new project and I should be adding things to it as often as I can. There you will find tools written in Java and Groovy/Grails using vijava. In time Perl scripts using the VMWare provided Perl SDK will show up, and there are already some Python scripts in there using the psphere library. I hope that you will fork the project and add your own stuff to it and share it back with everyone. The github project I started can be found here: https://github.com/michaelrice/VmOpsTools
In my first example I am going to show you how to use a few lines of simple python code along with psphere to get the total number of hosts in a vCenter. This is a handy report that you can send out to your management, or even put into some graphing program so you can watch for trends in your environment. If you run vCenter in linked mode you only need to hit the master vCenter to get ALL the hosts for that vCenter cluster.
Lets being with setting up our system. Im using an Ubuntu 11.10 server setup. I did a minimal install and selected OpenSSH Server for my server type. Once the system finished installing I logged in and and got the system up to date. I am of course running this Ubuntu server as a Virtual Machine, so the next thing I want to do after I install the base system and get it updated is to install the open-vm-tools package. Once that is done I reboot. Now I move on to setting up my python environment. Psphere requires Python Yaml, and Python Suds, and Python pip, once these packages are installed you can move on to the
pip install -U psphere And now your environment should be all ready to go for coding. Not to much to it. This should also work on Windows. For a reference Ubuntu 11.10 comes with Python 2.7.2, Suds 0.4.1, and Yaml 3.10, and at the time of this I am using psphere 0.5.1 As a note I first tried this using Debian 6.04 with Python 2.6.6 and it did not work, so for best results I can say I got it working with the above Ubuntu configuration..
Now lets cover the code it takes to connect to vCenter, and print all the hosts and at the end give the total number of HostSystem objects stored in this vCenter. Please note this code was tested on both 4.1 and 5.0 vCenter systems.
Open your favorite text editor. and enter the following:
from psphere.client import Client
from psphere.managedobjects import HostSystem
from getpass import getpass
usr = raw_input("vCenter user name: ")
passwd = getpass(prompt="vCenter password: ")
server = raw_input("vCenter server hostname or ip: ")
client = Client(server,usr,passwd)
hs = HostSystem.all(client)
for host in hs:
print "There were: " + str(len(hs)) + " HostSystems found in vCenter"
(Please note in the above code the indent is wrong so dont copy and paste, for some reason my wordpress theme is messing with the indents)
The code is pretty simple and wouldnt take much to modify to output into a csv with some more properties. You could also make it so you did not need to be prompted for user names and passwords or vcenters and just pass them in as an arg, or use the config file ~/.psphere/config.yaml
Switching your Falconstor IPStor server to use 1 to 1 mapping from any of the other avaliable mapping options Like All to All or All to 1 can be an annoying task, but if you have VMWare ESX or ESXi and have VMotion you can do this with 0 down time and Ill show you how. These steps will assume you are NOT in a fail over cluster with Falconstor
In my example I am using 2 ESX 4.1 hosts. Monster01 and Monster02. Each one of my hosts is designed to support running all our virtual machines from so moving all the vms to a single host like this is not going to have a negative impact on any vm and users will never know this is going on.
First Im going to need to vmotion all the machines to a single host. I move all the virtual machines running on Monster01 to the host Monster02. Once this is done I put Monster01 in maintence mode, then shut it down. This step is only needed if you are SAN booting your ESX/i host and need to change the LUN the ESX/i OS is running on.
Once its shut down comes the hard part if no one ever documented what WWPN is used for what. If that is the case for you like it was for me then you can figure this out by looking at your physical adapters and finding all the adapters that are in target mode. Write down the WWPN of each one. You might have a bunch.. Thankfully I only had 2 adapters in terget mode that were online. Yay!! a 50/50 chance of getting it right on the first try! I took LUN 0 which has my ESX 4.1 install on it and did a 1 to 1 map. On the ESX host this was simple since we only had 1 adapter plugged in and configred. Next I had to take a shot in the dark because our cables are a mess and no one documented what WWPN was used for what. I got it wrong the first time because once I assigned the LUN and turned the host back on the box failed
to boot. I switched to my other choice and Bam it booted!
Next to quickly switch the other 40 LUNS I went to the Falconstor management console and went into the SAN Clients and selected Monster01 I right clicked on each LUN and selected properties. From here you can switch from your current mapping to 1 to 1 using a select box. You will get a warning about data transmission stopping when you do this. That is fine since there are no running virtual machines on Monster01 (remember its still in maint mode) Next you select the 2 WWPNs needed for the initiator (the ESX host) and the target (the Falconstor server). Once you have completed this for all LUNs you can bring the ESX host out of maint mode and VMotion the machines from Monster02 to Monster01 and then repeat this process on Monster02.
I was sitting around tonight and had an idea. I wanted to know.. How hard is it to setup a load balancer using Rackspace Clouds new offering? I logged in to the Cloud Manager interface. On the left side of the screen I select Hosting to expose the hosting options. I clicked on Load Balancers. Next I clicked on Add Load Balancer. That brings you to the configuration page. This is where you begin by giving a name to the instance. Next choose the Protocol (http, https, smtp, custom, etc..). Then you select the Virtual IP type, there is clear concise documentation that explains the various options. Next you choose the algorithm that the balancer will use. In the next section you select the region for your balancer. I selected DFW because I have several servers (nodes) in San Antonio, and several in various data centers in the DFW area. Finally you add your nodes. The awesome part is that your nodes do not have to be Rackspace servers, be that virtual or physical. You can use physical servers or virtual, and they can be virtually anywhere.. For my test I added a node that was in the Slicehost DFW data center, next I added a node from Linode, also in their DFW data center. Finally I added a node from Serverbeach, a physical server that I lease in their San Antonio data center. Thats it. Your load balancer is setup. Assuming you selected the same options as I did: connection type: http, VIP type: public, algorithm: random, and that you wanted to set this up to load balance lbtest.mycoolsite.com all you need to do is go setup an A record in DNS for lbtest.mycoolsite.com to point at your VIP (provided to you by Rackspace). Next go to each of your nodes and configure apache with lbtest.mycoolsite.com as a vhost. Once that is complete you can visit lbtest.mycoolsite.com in your web browser and you are now load balancing! It so simple and only takes a few mins to setup.
I picked up a Herotab C8 a while back and I have had the WORST luck with the battery chargers. As of today I have gone through four of them. My dogs broke the first one, the second one I got showed up bad, and the third one my oldest child just broke on accident, so now I am on the fourth one. I picked it up from RadioShack this time instead of ordering it online. The adapter I got is one of their Enercell universal chargers (part number 273-318), and then I got an Enercell tip (part number 273-334) as well. The tip and charger can be set to tip+ or tip-. For the C8 you need to use tip+. Special thanks to Ponderous for letting me know what to use. The last replacement charger I got did not have it marked on the back. I hope this will be the last one of these chargers I buy..
Just a quick tip for vmware ESX. If you delete by mistake, or just need to add a vmnic to a vSwitch, and you do not have access to the ESX host using the GUI client all hope is not lost. You can still do this using the command line interface (or cli for short). To do so log into the ESX host as root, in my case I had to gain access to the console using the DRAC. Once logged in issue the following command:
This will list info about ALL of the vSwitches on this ESX host. Find the name of the switch you need to add this NIC to. In my case I need to add vmnic1 to vSwitch0. I accidently deleted it. To readd this NIC I will issue the following command:
esxcfg-vswitch -L vmnic1 vSwitch0
I can verify this worked by using the -l switch again and I will see that the vSwitch0 now has vmnic1 in the list of uplinks.
Today I built a new server for us to start testing out splunk. When I built it I used LVM. I also agreed to the default layout using split partitions on the Debian 6 install. So I ended up with a partition for / /var and /home and /tmp. I always like splitting partitions up like this, and I ALWAYS use LVM. Once the new server was booted up and ready for me to begin the splunk install I did so using their deb package. That put everything for splunk into /opt which did not have its own partition, and as a result I needed to add a new disk, and create a partition that could be mounted to /opt. Since I used LVM this became a trivial task. I will show you the steps to take if you need to do what I did.
First we need to stop splunk and move it out of /opt for a moment.
Once you see this info you should be ready to move splunk:
Shutting down. Please wait, as this may take a few minutes.
Stopping splunk helpers…
Next we will move the splunk install to /tmp while we do this disk stuff. If you do not move it you will notice once the new opt is created that splunk is gone (sort of, its really just hidden), so its best to just move it for now.
mv /opt/splunk /tmp
This will move the splunk install to /tmp.
Next, I am going to assume your new disk is already accessible to the system. If its not then make it that way, so we can partition it with fdisk
sdb Was the disk I added to my system. Here I am going to create a new primary partition and set its type to 8e which is Linux LVM. I want to use the whole disk but you may want to only allocate a small amount of it.. Once you have written the changes and fdisk is done its time to begin the LVM steps.
The first step is to create a disk using pvcreate
You should get a message like this:
Physical volume “/dev/sdb1″ successfully created
If so we can move on to the next step. In my setup I want to add this new disk to the existing volume group which is named splunk. To do that I will use vgextend
vgextend splunk /dev/sdb1
If the command was successful you should be greeted with the following message:
Volume group “splunk” successfully extended
You can verify this using vgdisplay
You should see something similar showing the new Free PE or the Total PE as being larger. In my case the Total increased by 10G, and the Free shows I now have 10G free.
— Volume group —
VG Name splunk
Metadata Areas 2
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 2
Act PV 2
VG Size 29.75 GiB
PE Size 4.00 MiB
Total PE 7617
Alloc PE / Size 5058 / 19.76 GiB
Free PE / Size 2559 / 10.00 GiB
VG UUID DtBgbf-pDPY-JLFo-cjv2-ydUC-nyiH-lzqzys
Now I can create a new logical volume. I am only going to use 8 of the 10G I added, and name it “opt” since that will be its mount point:
lvcreate -L 8G -nopt splunk
If that command was successful you will see a message like mine:
Logical volume “opt” created
You can look at the info about the new volume using lvdisplay
Here is the opt section of my output
— Logical volume —
LV Name /dev/splunk/opt
VG Name splunk
LV UUID 5fAiFp-fpmd-dlUa-mgHl-nNcy-kX9G-RLHDaC
LV Write Access read/write
LV Status available
# open 0
LV Size 8.00 GiB
Current LE 2048
Read ahead sectors auto
– currently set to 256
Block device 254:6
Now all thats left is adding a filesystem to this volume and mounting it. I am using ext3, so I will use the following command:
mke2fs -j /dev/mapper/splunk-opt
After the normal output from mke2fs I need to amend my fstab to auto mount my new filesystem for me on boot.
I will add the following to that file:
/dev/mapper/splunk-opt /opt ext3 defaults 0 2
Save this file. Now mount the new file system. You should also move anything else that is currently in /opt to /tmp while you do this or it will also appear to be gone.. To mount the new file system simply:
This will mount the new logical volume to /opt for you. Verify that with df or mount. Once its verified that it is in fact mounted you can safely move all your data back to /opt
mv /tmp/splunk /opt
Now you can start splunk back up