July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Enable remote connections for SQL Server Express 2012

On my installation of SQL Server 2012 Developer Edition, installed with default settings, I just had to load the SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for MSSQLSERVER and change TCP/IP from Disabled to Enabled.

 

down voteaccepted

Well, glad I asked. The solution I finally discovered was here:

How do I configure SQL Server Express to allow remote tcp/ip connections on port 1433?

  1. Run SQL Server Configuration Manager.
  2. Go to SQL Server Network Configuration > Protocols for SQLEXPRESS.
  3. Make sure TCP/IP is enabled.

So far, so good, and entirely expected. But then:

  1. Right-click on TCP/IP and select Properties.
  2. Verify that, under IP2, the IP Address is set to the computer’s IP address on the local subnet.
  3. Scroll down to IPAll.
  4. Make sure that TCP Dynamic Ports is blank. (Mine was set to some 5-digit port number.)
  5. Make sure that TCP Port is set to 1433. (Mine was blank.)

(Also, if you follow these steps, it’s not necessary to enable SQL Server Browser, and you only need to allow port 1433, not 1434.)

These extra five steps are something I can’t remember ever having had to do in a previous version of SQL Server, Express or otherwise. They appear to have been necessary because I’m using a named instance (myservername\SQLEXPRESS) on the server instead of a default instance. See here:

 

 


To assign a TCP/IP port number to the SQL Server Database Engine

  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.
  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.
  3. If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.
  4. In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then click OK.
  5. In the console pane, click SQL Server Services.
  6. In the details pane, right-click SQL Server (<instance name>) and then click Restart, to stop and restart SQL Server.

After you have configured SQL Server to listen on a specific port, there are three ways to connect to a specific port with a client application:

  • Run the SQL Server Browser service on the server to connect to the Database Engine instance by name.
  • Create an alias on the client, specifying the port number.
  • Program the client to connect using a custom connection string.

 

You can use this to solve this issue:

Go to START > EXECUTE, and run CLICONFG.EXE.

The Named Pipes protocol will be first in the list.Demote it, and promote TCP/IP.

 

test

winnt_accept: Asynchronous AcceptEx failed.

[Sun May 26 12:23:42.649103 2013] [mpm_winnt:notice] [pid 1356:tid 352] AH00424: Parent: Received restart signal — Restarting the server.
[Sun May 26 12:23:43.616304 2013] [mpm_winnt:notice] [pid 1356:tid 352] AH00455: Apache/2.4.4 (Win64) OpenSSL/1.0.1e PHP/5.4.14 configured — resuming normal operations
[Sun May 26 12:23:43.616304 2013] [mpm_winnt:notice] [pid 1356:tid 352] AH00456: Server built: Feb 22 2013 22:08:37
[Sun May 26 12:23:43.616304 2013] [core:notice] [pid 1356:tid 352] AH00094: Command line: ‘c:\\apache2\\bin\\httpd.exe -d C:/Apache2’
[Sun May 26 12:23:43.616304 2013] [mpm_winnt:notice] [pid 1356:tid 352] AH00418: Parent: Created child process 3840
[Sun May 26 12:23:44.443106 2013] [mpm_winnt:notice] [pid 3840:tid 240] AH00354: Child: Starting 64 worker threads.
[Sun May 26 12:23:44.458706 2013] [mpm_winnt:warn] [pid 3840:tid 1596] (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.
[Sun May 26 12:23:44.458706 2013] [mpm_winnt:warn] [pid 3840:tid 1596] (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.
[Sun May 26 12:23:44.458706 2013] [mpm_winnt:warn] [pid 3840:tid 1596] (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.
[Sun May 26 12:24:09.621550 2013] [mpm_winnt:warn] [pid 3840:tid 1596] (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.

[NOTE THE RESTART OF APACHE WHICH IS REQUIRED TO KEEP THE SERVER OPERATIONAL]

 

sure you have in httpd.conf:

For 2.2:
Win32DisableAcceptEx
EnableSendfile off
EnableMMAP off

For 2.4:
AcceptFilter http none
AcceptFilter https none
EnableSendfile off
EnableMMAP off

How to change a network interface name on CentOS 7

Traditionally, network interfaces in Linux are enumerated as eth[0123…], but these names do not necessarily correspond to actual hardware slots, PCI geography, USB port number, etc. This introduces a unpredictable naming problem (e.g., due to undeterministic device probing behavior) which can cause various network misconfigurations (e.g., disabled interface or firewall bypass resulting from unintentional interface renaming). MAC address based udev rules are not so much helpful in a virtualized environment where MAC addresses are as euphemeral as port numbers.

CentOS/RHEL 6 has introduced a method for consistent and predictable network device naming for network interfaces. These features uniquely determine the name of network interfaces in order to make locating and differentiating the interfaces easier and in such a way that it is persistent across later boots, time, and hardware changes. However, this naming rule is not turned on by default on CentOS/RHEL 6.

Starting with CentOS/RHEL 7, the predictable naming rule is adopted by default. Under this rule, interface names are automatically determined based on firmware, topology, and location information. Now interface names stay fixed even if NIC hardware is added or removed without re-enumeration, and broken hardware can be replaced seamlessly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
* Two character prefixes based on the type of interface:
*   en -- ethernet
*   sl -- serial line IP (slip)
*   wl -- wlan
*   ww -- wwan
*
* Type of names:
*   b<number>                             -- BCMA bus core number
*   ccw<name>                             -- CCW bus group name
*   o<index>                              -- on-board device index number
*   s<slot>[f<function>][d<dev_port>]     -- hotplug slot index number
*   x<MAC>                                -- MAC address
*   [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
*                                         -- PCI geographical location
*   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..]1[i<interface>]
*                                         -- USB port number chain

A minor disadvantage of this new naming scheme is that the interface names are somewhat harder to read than the traditional names. For example, you may find names like enp0s3. Besides, you no longer have any control over such interface names.

 

eth0001

 

If, for some reason, you prefer the old way, and want to be able to assign any arbitrary name of your choice to an interface on CentOS/RHEL 7, you need to override the default predictable naming rule, and define a MAC address based udev rule.

Here is how to rename a network interface on CentOS or RHEL 7.

 

eth0002

 

First, let’s disable the predictable naming rule. For that, you can pass “net.ifnames=0” kernel parameter during boot. This is achieved by editing /etc/default/grub and adding “net.ifnames=0” to GRUB_CMDLINE_LINUX variable.

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.13.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.13.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-11510efe0881461cb2aa7cb613f65395
Found initrd image: /boot/initramfs-0-rescue-11510efe0881461cb2aa7cb613f65395.img
done

 

Next, edit (or create) a udev network naming rule file (/etc/udev/rules.d/70-persistent-net.rules), and add the following line. Replace MAC address and interface with your own.

$ vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:58:a6:b7″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”mohan”
eth0003

Web server benchmarking tools for Linux

As far as web server performance is concerned, there are many different factors at play, e.g., application design, network latency/bandwidth, web server configuration, caching, hardware capability, server load, etc. To compare and optimize web server performance under such a wide array of factors, we often perform load test (or stress test) using a web server micro-benchmark tool. A typical benchmark tool injects synthetic workloads into a web server, and measures web server performance in terms of different metrics (e.g., response time, throughput, number of requests per second, etc).

Here are a list of web server benchmark tools available on Linux platforms.

 

 

1. ApacheBench (ab): an Apache HTTP server command-line benchmark tool which can send an arbitrary list of (concurrent) web requests. Support for POST/PUT/GET requests, as well as basic password authentication is available. Testing results include requests per second, time per request, transfer rate, connection time statistics (min, max, median, mean), etc. License: Apache v2.0

2. Apache JMeter: a cross-platform GUI program written in Java designe to stress test any web application. It can be used to test the performance of web-server backends powered by server-side languages (e.g., PHP, Java, ASP.NET) or databases (e.g., JDBC, LDAP, MongoDB). It features pluggable testing architecture, extensible data visualization GUI. License: Apache v2.0

3. curl-loader: a command-line application workload generator which can simulate multiple HTTP/HTTPS FTP/FTPS clients. Simulated clients can conduct various tasks, such as authenticated login (POST or GET/POST), GET/POST/PUT requests from batch configuration with probabilistic distribution, FTP passive/active operations, HTTP logoff (POST, GET/POST, GET with cookie), etc. Per-client status and statistics are logged to a file. License: GPLv2

4. FunkLoad: a web server load testing tool written Python. It can perform functional unit testing, as well as stress and longevity testing. Features include GET/POST/PUT/DELETE requests, basic authentication, cookie, HTTPS with SSL/TLS, browser cache emulation, and CSS/image/JavaScript fetching. License: GNU GPL

5. Gatling: an open-source protocol-agnostic load testing tool, used primarily to benchmark HTTP servers. It can simulate multiple users whose web browsing behaviors and scenarios (e.g., login, browse product listings, add a product to cart, check out) can be scripted. License: Apache v2.0

6. Httperf: an HTTP workload generator command-line tool which can generate a number of different types of HTTP traffic, including GET/HEAD/PUT/POST requests, HTTP pipelining, SSL traffic, stateful sessions with cookie, etc. Output includes connection rate, connection time statistics (min, max, median, stddev), request/reply rate, and network throughput. License: GNU GPLv2

7. Siege: an HTTP load testing and benchmarking tool for terminal environment. Support for basic password authentication, cookies, HTTPS with SSL is available. License: GNU GPL

8. Tsung: an open-source multi-protocol stress test tool which can generate different types of workloads for HTTP, SSL, WebDAV, SOAP, PostgresSQL, MySQL, LDAP, XMPP servers. With HTTP server testing, it supports basic requests (GET/POST/PUT/DELETE/HEAD), cookies, authentication with password or oAuth, SOAP, graph visualization and HTML report, multiple IP addresses via IP aliasing, etc. License: GNU GPLv2

9. Web Polygraph: a workload generator tool that can simulate HTTP, FTP, SSL traffic for benchmarking. It comes with HTTP client and server which, together, can stress test caching proxies, web server accelerators, content filters, etc. Support for LDAP credentials, basic/NTLM/Kerberos authentication is available. License: Apache v2.0

10. wrk: a scalable HTTP benchmarking tool which leverages lightweight event notifications like epoll and kqueue. Support for LuaJIT-scripted workloads, HTTP pipelining, authentication token, dynamic requests, and customizable report is available. License: Apache v2.0

CentOS 7 & firewallD

Usually one of the first things we want to do with a new server is to restrict access to SSH -service.

So far it seems that everyone advices “disable firewallD, install iptables service and use it like you’ve always used” but how about trying to get along with this new tech?

Restricting access to SSH isn’t as hard as it might seem at the first glance. First we check what services are allowed in public (usually the default) and internal -zones:

# firewall-cmd --zone=internal --list-services
dhcpv6-client ipp-client mdns samba-client ssh
# firewall-cmd --zone=public --list-services
dhcpv6-client ssh

Then we add our admin-IP to internal -zone:

# firewall-cmd --permanent --zone=internal --add-source=<admin-ip>

Remove access to SSH-service from public:

# firewall-cmd --permanent --zone=public --remove-service=ssh

And reload the changes into use:

# firewall-cmd --reload

–permanent makes changes which stay over reboot/reload, but they aren’t active immediately – without –permanent the changes are active immediately but are lost on reload/reboot

Service definitions can be found (in RHEL/CentOS 7) at /etc/firewalld/services/ – if you create a new one -> use –reload to make it active.

Ngix web

yum -y install make gcc gcc-c++ autoconf

wget http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&ts=1419041744&use_mirror=softlayer-sng

mv pcre-8.36.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F pcre-8.36.tar.gz

groupadd www
useradd -g www www

yum repo for ngix

[root@test1 software]# cat /etc/yum.repos.d/ngix.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
[root@test1 software]# yum install nginx
wget http://nginx.org/download/nginx-1.7.8.tar.gz

tar zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install

cd nginx-1.7.8
yum -y install openssl*
./configure –user=www –group=www –prefix=/usr/local/web/nginx –with-http_stub_status_module –with-http_ssl_module
make && make install
cd /usr/local/web/nginx/conf/
cp nginx.conf nginx.conf.org
sed -i “s#\#gzip\ \ on;#\#gzip\ \ on;\n\n include\ \ vhosts/*.conf; #g” /usr/local/web/nginx/conf/nginx.conf

cat << EOF >> /usr/local/web/nginx/conf/vhosts/rmohan.com.conf

server

{

listen 80;

server_name rmohan.com;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host \$host;

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header REMOTE-HOST \$remote_addr;

proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com;

}

}

server

{

listen 8081;

server_name rmohan.com:8081;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host \$host;

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header REMOTE-HOST \$remote_addr;

proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com:8081;

}

}

EOF
ln -s /usr/local/lib/libpcre.so.1 /lib64/

ulimit -SHn 51200
/usr/local/web/nginx/sbin/nginx

/usr/local/web/nginx/conf?????ssl(????ssl??)

openssl genrsa -des3 -out rmohan.com.key 1024

openssl req -new -key rmohan.com.key -out rmohan.com.csr

cp rmohan.com.key rmohan.com.key.orgi

openssl rsa -in rmohan.com.key.orgi -out rmohan.com.key

openssl x509 -req -days 365 -in rmohan.com.csr -signkey rmohan.com.key -out rmohan.com.crt

2.?nginx.conf??????????????

include vhosts/rmohan.com.conf;

server {

listen 80;

server_name localhost;

location / {

root html;

index index.html index.htm;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

server {

listen 443 ssl;

server_name rmohan.com;

ssl on;

ssl_certificate ssl/rmohan.com.crt;

ssl_certificate_key ssl/rmohan.com.key;

keepalive_timeout 60;

ssl_protocols SSLv2 SSLv3 TLSv1;

ssl_prefer_server_ciphers on;

access_log /usr/local/web/nginx/logs/ssl-access.log;

error_log /usr/local/web/nginx/logs/ssl-error.log;

location / {

proxy_pass https://rmohan.com;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

proxy_redirect off;

}

}

}

3.vhosts rmohan.conf

server

{

listen 80;

server_name rmohan.com;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header REMOTE-HOST $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan.com;

}

}

server

{

listen 8082;

server_name rmohan.com:8082;

charset GB2312;

index index.html index.htm;

root /var/www/html/rmohan.com/;

location ~ ^/NginxStatus/ {

stub_status on;

access_log off;

}

location / {

proxy_redirect off ;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header REMOTE-HOST $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 50m;

client_body_buffer_size 256k;

proxy_connect_timeout 30;

proxy_send_timeout 30;

proxy_read_timeout 60;

proxy_buffer_size 256k;

proxy_buffers 4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 256k;

proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

proxy_max_temp_file_size 128m;

proxy_pass http://rmohan:8082;

}

}

MySQL: changing the storage location for databases

By default when you install MySQL it stores databases on the C drive, you can change this during installation but perhaps you forgot to change the data files path during installation or completely missed the option to do this, or perhaps you used the Web Platform Installer which doesn’t give you any option to change the data files path.

On windows 2008 the datadir is “C:\ProgramData\MySQL\MySQL Server 5.5\data”

This is generally not the best idea as your c drive should be only for the OS and installed programs, you should put all your data on a different drive and keep it separate from the OS. So if you find yourself needing to change this after installation, here is how.

Open your my.ini file

On windows 2008 this is in C:\ProgramData\MySQL\MySQL Server 5.5\”

On other windows version just look at the mysql service properties to find out where the defaults-file is.

 

 

mysql-service

 

now find the “datadir” parameter and change it to where you want to store your databases.

E.G.
datadir=”D:\MySQL\data\”

Now STOP the MySQL service.

Now you must copy the original data directory to the new location.

E.G.
copy “C:\ProgramData\MySQL\MySQL Server 5.5\data” to “D:\mysql\data”

now restart MySQL.

If the service fails to start, double check that you have entered the path correctly in my.ini and that the path exists, and that all the data files have copied across properly.

Check your new data folder permissions and make sure it has “NETWORK SERVICE” with full permissions. On Windows 2008 these permissions may not exist by default.

 

mysql-service

 

 

 

From your paths, I can safely assume the following:

  • You are running MySQL in Windows
  • You used the MySQL MSI to install

What you need to do is establish the file my.ini

When installing MySQL for Windows using the MSI, the location of my.ini is expected to be C:/ProgramData/MySQL/MySQL Server 5.1.

Please run the following in a DOS Window:

cd C:/ProgramData/MySQL/MySQL Server 5.1
dir *.ini

You will see some sample my.ini files. However, if there is no file named my.ini in that folder, you must create one. Whether one exists or not, please run this:

cd C:/ProgramData/MySQL/MySQL Server 5.1
notepad my.ini

If you are asked to create it, please do so.

Next, create the following entry under the [mysqld] group header in my.ini:

[mysqld]
datadir=F:/naveen/data

Save my.ini

Next, stop mysql from the DOS command line like this:

C:\> net stop mysql

Next, make a copy of the entire data folder in the new location

C:\> xcopy "C:\ProgramData\MySQL\MySQL Server 5.1\data" F:\naveen\data /s

Last step, start up mysql

C:\> net start mysql

Try logging into mysql. Once you can login to mysql successfully, run this command:

show variables like 'datadir';

If F:\naveen\data shows up as the datadir, CONGRATULATIONS, YOU HAVE DONE IT RIGHT !!!

Once you are satisfied all your apps hitting MySQL works, you can delete everything in C:\ProgramData\MySQL\MySQL Server 5.1\data\*

Give it a Try !!!

Logical Volume Snapshots

Logical Volume Snapshots

Objective:  Creating and restoring manual logical volume snapshots.
Environment: CentOS release 6.3 (32-bit).
Descriptions:
By LV snapshot you will be able to freeze your logical volumes. In other words, you can easily backup and rollback to a original logical volume state. This is almost similar to VMware where you can the snap shot of the VM and revert in-case if anything goes wrong.
Concept of snapshot are just like the symbolic links, where you don’t create a file, instead you only reference to it. Here, two essential parts are
1. Metadata.
2. Data blocks.
When a snapshot is created Logical Volume Manager simply creates a copy of all Metadata pointers to a separate logical volume, snapshot volume only starts grow once you start altering data of the original logical volume.
Implementation:
Since my server was not created using LVM, I have created two partitions and changed them to LVM.
Change plan:
1. Create two partitions on /dev/sda drive.
2. Create physical volumes on the two drives.
3. Create volume group.
4. Create a single logical volume using ext3 file system.
5. Take snapshot and remove data
6. Rollback logical volume snapshot
Technical Implementation:
 
1. Created two physical partitions:
tux#fdisk -l | tail -2
/dev/sda5            2305        2366      497983+  8e  Linux LVM
/dev/sda6            2367        2428      497983+  8e  Linux LVM
tux#
2. Created Physical Volumes:
tux#pvcreate /dev/sda[5-6]
  Physical volume “/dev/sda5” successfully created
  Physical volume “/dev/sda6” successfully created
tux#
3. Created volume groups:
tux#vgcreate vol_grp /dev/sda5 /dev/sda6
  /dev/hdc: open failed: No medium found
  Volume group “vol_grp” successfully created
tux#
4. Created single logical volume of 100Mb with ext3 file system.
tux#lvcreate -L 100M -n lv1 vol_grp
  Logical volume “lv1” created
tux#
tux#mkfs.ext3 /dev/vol_grp/lv1
mke2fs 1.39 (29-May-2006)
.
.
tux#
Finally, we have come to the point where we can take a snapshot of our logical volume, for this we will also need some sample data on our Logical Volume, so once we revert from the snapshot we can confirm entire process by comparing original data with data recovered from the snapshot.
Create a mount directory for the logical volume and mount it.
tux#mkdir /mnt/lv1
tux#mount /dev/vol_grp/lv1 /mnt/lv1
tux#
tux:/mnt/lv1#cp -r /sbin/ .
tux:/mnt/lv1#cp -r /bin/ .
tux:/mnt/lv1#du -s .
39312   .
tux:/mnt/lv1#
5. Creating the LV snapshot.
tux:/mnt/lv1]#lvcreate -s -L 30M -n lv1_snapshot /dev/vol_grp/lv1
  Rounding up size to full physical extent 32.00 MB
  Logical volume “lv1_snapshot” created
tux:/mnt/lv1]#
Execute lvs to confirm that new volume snapshot has been created.
tux:/mnt/lv1]#lvs
  LV           VG      Attr   LSize   Origin Snap%  Move Log Copy%
  lv1          vol_grp owi-ao 100.00M
  lv1_snapshot vol_grp swi-a-  32.00M lv1      0.07
tux:/mnt/lv1]#
Since the snapshot was already created, now you can alter the data on the volume group.
tux:/mnt/lv1]#rm -rf ./bin/
tux:/mnt/lv1]#rm -rf ./sbin/
tux:/mnt/lv1]#du -s .
13      .
tux:/mnt/lv1]#
6. Rollback logical volume snapshot.
tux:/mnt/lv1]# lvconvert –merge /dev/vol_grp/lv1_snapshot
  Can’t merge over open origin volume
  Merging of snapshot lv1_snapshot will start next activation.
tux:/mnt/lv1]#
tux#umount /mnt/lv1
Deactivate and activate you volume:
tux# lvchange -a n /dev/vol_grp/lv1
tux# lvchange -a y /dev/vol_grp/lv1
As a last step mount again your logical volume “lv1” and confirm that data all has been recovered:
tux# mount /dev/vol_grp/lv1 /mnt/lv1
tux:/mnt/lv1]# ls
bin  lost+found  sbin
tux:/mnt/lv1]#
tux# du -s /mnt/lv1/
39312   .
Snapshot was rolled back.
Objective successful 

ISO – Mount/Unmount

ISO – Mount/Unmount

Objective: 
1. Mount the ISO to CD/DVD, then mount it to file system.
2. Create an ISO from the CD/DVD, then mount to file system.
3. Created ISO will be mounted, and will be mounted as an file system.
Environment: CentOS release 6.3 (32-bit).
Implementations:
 
– Mounted my ISO image to CD/DVD, then copy files.
# mount -r -t iso9660 /dev/sr0 /mnt
# cd /mnt
# du -sh .
3.5G    CentOS_6.3/
Created an ISO image from the CD/DVD image.
WARNING: Check the free disk space before using below.
# dd if=/dev/sr0 of=/root/centos6.3.iso
# ls -l  /root/centos6.3.iso
-rw-r–r– 1 root root 3713204224 Jun 17 10:04 centos6.3.iso
Local ISO image created on the system can be mounted to CD/DVD.
#mount -o loop -t iso9660 centos6.3.iso /mnt/isoimage/
tux:/mnt/isoimage]# du -sh .
3.5G    .
tux:/mnt/isoimage]#
Since my colleagues faced difficulty in creating the local/remote repositories, I thought I should write this, as it plays very crucial role in creation.
 I would post up How to create local/remote Redhat/CentOS repository in coming days.

Root login on Oracle Solaris 11

Once after your installation is completed, you will not be able to login directly to the console as the user “root”.
user root should be assigned role as a normal user.
Below are the very few steps to enable root login.
1. #vim /etc/ssh/sshd_config [ change parameter to yes ]
      PermitRootLogin yes
 
2. #vim /etc/default/login  [ Comment the below line ]
      #CONSOLE=/dev/console
3. Remove “;type=role” from the root entry in /etc/user_attr
                     or
         use the below command
       #rolemod -K type=normal root
4.  Restart service
       #svcadm restart svc:/network/ssh:default