星期二 十一月 25, 2008

Snapshot in OpenSolaris and system recovery based on zfs

In Solaris 10 or other type of Solaris based on ufs file system, you
can use the command“ufsdump” or “ufsrestore” to backup or recover the file
system(you should uninstall the file system firstly), and use “fssnap” to
create an online snapshot of the file system to backup it. Snapshot is an
excellent solution of the online file system backup.

[Read More]

星期三 六月 25, 2008

Solaris File System Administration

 Solaris OS file system is very different from Windows OS.FAT16,FAT32,NTFS are file systems for Windows,But Solaris belong to UNIX architecture .Learning Solaris file system is a difficulty for the beginner.
      What is file system? Simply,file system is a directory collections ,and it is used for locating and storing file.

[Read More]

Run Windows Programs in OpenSolaris 2008.05

Authorhongbingfeng

       Emailbfhong@gmail.com


   Under Opensolaris ,we can run Linux program by many way,such as zone and so on .Actually Opensolaris can aslo run Windows Programs.


The article introduce wine and use wine to run Windows Programs in Opensolaris 2008.05.


Tools:     OpenSolaris 2008.05


               Wine 1.0-rc1

[Read More]

星期日 五月 25, 2008

Manage ZFS with Web Console

Manage ZFS with Web Console   


ZFS file system is the an important feature to the Solaris 10, it is not an improvement for the old file system, but a new one. ZFS is the first file system with 128 bit, and it have the features of infinity capacity、freeness、consistent data and easy management.


ZFS abandon the volume management, and adopt the pool conception. The volume management is a way to manage the physical storage devices, and the pool is to manage the virtual device, the virtual devices could be file and device set, besides the physical device. We con add devices into the pool expediently, and all the devices in the pool can be shared by all the file systems that used the pool. When we make a new file system, we need not to assign it to an independent device any more, other than, we can set the size and attributes of the file system by ourselves.


In the Solaris 10, we can use the command to manage the ZFS, and also, there is a Web Console for us to manage the ZFS.


To use the Web Console, we can type the URL:https://hostname:6789 or https://host-id:6789 in the browser.


1、type https://127.0.0.q:6789 in the browser to open Web Console.



 


2、type the user name and password to login in.


 


 


3、Choose the “ZFS管理” to get into the ZFS management interface.


 


 


4、Choose the “创建存储池” to create a new pool. 


 


 


5、Name the pool, choose redundancy level, and create the pool with the guide. There, I use an U disk to create a pool. Of course, you can make a pool with files. 


5            #format –e   -------------See the name of my U disk.


 My U disk name is c4t0d0.


       #zpool create dh c4t0d0  ---------------Create a pool which is named "dh".


 


6、To see the pool and the file system that have been created.


 


 


7、We can create the new data set in the appointed pool with the Web Console.


 


 


8、Define the file system that we will create. there, I create a sub file system with the name  "Tonsen" below the file syetem whose name is "dh". in fact, "Tonsen" is my English name, and "dh" my Chinese name for short.  \^-\^



 


    9、Set the mountpoint for the file system. In the ZFS, if we set the mountpoint, the file system will be mounted automatically.


 


 


10、Set the quota and reservation for the file system.


 


 


11、Set other attributes for the file system.


 


 


12、 Check the setting that you made.



 


13、We can also see the commands about the setting that we done with the Web console.



 


14、Open a terminal, type the command to check the pool and zfs.



 


the Chinese blog site:


http://developers.sun.com.cn/blog/functionalca/entry/%E4%BD%BF%E7%94%A8web_console%E7%AE%A1%E7%90%86zfs

Solaris User Management

      Solaris OS has a core conception --- user and user account management .User has all of processes and files . If OS has no users,it can not finish data operation and system management. User must has an account to login the system,and he can finish the  prospective work. As Solaris system administrator, it is a key job to manage user and account(there are some conception about user group,but I do not introduce this).


     The loginning name has 8 characters at most. After creating the account, we can :1.start Shell; 2.implement application program ;3.call all kinds of system serveice. User management refer to 3 document: 1./etc/passwd: user acconut information. 2./etc/group:group configuration information; 3./ect/shadow: account password and all kinds of control information. Solaris integrate user account management into SMC,and SMC help administrators manage system and applications.Besides SMC, we can finish management work by command-line.


     1.add user:#useradd -u uid -g gid -d home_directory -s path_to_shell -c comment login_name 


    2 change user account attribute:usermod


    3 delete user:userdel


DEMO 1


add user sun1 and sun2:


#useradd -u 200 -g other -d /export/home/sun1 -m -c "first user" -k /etc/skel sun1


#useradd -u 300 -g other -d /export/home/sun2 -m -s /usr/bin/sh -c "second" sun2


change user UID,and change the password:


#usermod -u 400 sun1


#grep sun1 /etc/passwd


#passwd sun1


change user and user home:


#usermod -d /export/home/sun22 -m -l sun22 sun2


#ls -ld /export/home/sun22


user accuont control strategy,lock and unlock:


#usermod -f 10 -e 12/31/2008 sun1


#passwd -l sun1


#passwd -u sun1


delete user


#userdel -r sun1


DEMO2


create the bulk of user


1.create user list file:userlist.lst    #cat/export/home/userlist.lst


sun1 sun2 sun3


2.create Script file:adduser.sh,#cat/export/home/adduser.sh


for i in 'cat/export/home/userlist.lst'
                          do
                            useradd -d /export/home/$i -m $i
                          done


#chmod u+x /export/home/adduser.sh


3.run script file:#./export/home/adduser.sh


The end !Thank you very much!


 

星期六 五月 24, 2008

Share Files btween OpenSolaris 2008.05 on VMWare and Windows

OpenSolaris2008.05 is the new edition  of the Solaris Indiana program.we can install it in disks,either we can aslo install and experience it on virtual mathine,such as Vmware,Virtual Box. The installtion process can be seen :


http://www.unix-center.net/opensolaris/getting_started.html#3_7


By practice,the article sum-up and introduce some kinds of methods which can implement file sharing between OpenSolaris 2008.05 on VMWare and windows .


Hosts   :   Windows XP


Virtual Mathine: Vmware 6.0


Guest:    OpenSolaris 2008.05



FirstTransmit files using FTP by Configuing FTP server in solaris


The process as follows:


     1.first,login as root,or use su switch to root


    2. examine ftp serve open or not


       #svcs -l network/ftp


fmri         svc:/network/ftp:default


name         FTP server


enabled      true


state        online


next_state   none


    3.If ftp serve is close,use the method open it as follow ,and examine state.


       # svcadm enable /network/ftp


    4.after turn on the ftp service,we aslo need congfigue the ftp users, which were includes /etc/ftpd/ftpusers file. The users in this file are unusable for ftp. That is,mark ‘#’is usable,or is forbid. So ,if we want to make one user usable ,we only need to mark ‘#’ in front it.We change the root is usable.If we want to add the new ftp user,we can reference solaris order how to add user. If we want to display the user which have already exist,we can add it the file ,mark # in front of the user name.


    5 obtain OpenSolaris IP,use #ifconfig –a


    6.After setting the account ,we can connect OpenSolaris in Windows by ftp.The username is ftp account and password in OpenSolaris.If you use the right root accout and password,but show is error, reference follow.


    7.if you use the right root account and password, but show the user name or password is error,maybe the reason that OpenSolaris 2008.05 is unallowed root login default. You can using common acount to login ,and then switch to root by su, the implement as follow:


   # rolemod -K type=normal root


And that you can use the root account.


 


SecondUsing smaba client to connect the share documents in Windows


Process as follow:


1.Use root logining or use su switch to root


       2.open samba client , order as follow:


       #svcadm enable svc:/network/smb/client:default


       #svcs -l  /network/smb/client check the client state


3.Suppose Windows  IP   is 192.168.1.109,sharing a  ‘Soft’ directory ,and then use follow order:


       #mount -F smbfs  //192.168.1.109/Soft /mnt


       Password:     enter your current account password in Windows


       # cd /mnt


       # ls


       And then you can see the share directory of Windows.


 


Reference:


       http://www.unix-center.net/opensolaris/getting_started.html#3_7


       http://www.itwenku.com/linux/1/53039.htm


 


You can find the article in Chinese by the link:

http://developers.sun.com.cn/blog/functionalca/entry/vmware%E4%B8%8A%E5%AE%9E%E7%8E%B0opensolaris_2008_05%E4%B8%8Ewindows%E4%B9%8B%E9%97%B4%E7%9A%84%E6%96%87%E4%BB%B6%E5%85%B1%E4%BA%AB

星期五 四月 25, 2008

The demo for Identifying File Types

Identifying File Types


In this demo, you complete the following tasks:


1.Navigate within the directory hierarchy


2.Identify different types of files


Complete the following steps:
1. Log in as the root user, and open a terminal window. In the / (root)
directory, perform a long listing, and record the name of the first
symbolic link listed.


# cd /
# ls -l


2. What is the size in bytes of the link you found in Step 1? How many
characters are there in the name of the file to which this link points?
The /bin symbolic link contains 9 bytes of data and points to ./usr/bin.


3. Change to the /dev/dsk directory. Record the file types that you find
in this directory.


# cd /dev/dsk


4. Use the appropriate options of the ls command to display
information for the files referenced by the files in the /dev/dsk
directory. Record the file types reported.


# ls -lL


5. Change to the /dev/pts directory, and use the same commands you
used in Steps 3 and 4 for the /dev/dsk directory. Record the file
types you find.


# cd /dev/pts
# ls -l
# ls -lL


6. Change to the /etc/init.d directory, and identify the type of file in
this directory.


# cd /etc/init.d ; ls -l


7. How many hard links are associated with the /etc/init.d/volmgt
file? What is the inode number associated with this file?
# ls -li volmgt


8. Find the number of files in the /etc directory or below that have the
same inode number as that used by the /etc/init.d/volmgt file. In
this example, the inode number is 21449.
# ls -i /etc/init.d/volmgt
21449 -rwxr--r-- 6 root sys 473 Sep 3 15:37 volmgt


# find /etc -inum 21449 -exec ls -i {} \\;


9. Create a new directory called /testdir. Create a file in this directory
called file1.


# mkdir /testdir
# cd /testdir
# touch file1
# ln -s file1 link1


10. List file1 and the link1 symbolic link. Do these files use the same
or different inodes?
# ls -li


11. In the /testdir directory, create a new directory called newdir.


# mkdir newdir
# ls -ldi newdir


12. List all files, including hidden files, that exist in the newdir
directory.


# ls -lia newdir


13. Create a new directory called dir2 below the newdir directory. What
happens to the link count for the newdir directory?


# mkdir newdir/dir2
# ls -ldi newdir


14. Use the ls command with appropriate options to find the new file
name that uses the same inode as the newdir directory. Record the
name of the new file.


# ls -laRi newdir


 

星期四 四月 24, 2008

Enlarge Upload File Size in CoolStack PHP

If you want to enlarge upload file size (e.g. 1000M) in CoolStack PHP on Solaris. You may just edit the file "/opt/coolstack/php5/lib/php.ini", and
add "upload_max_filesize = 1000M" and "post_max_size = 1000M" in the part of [PHP].

At the end, don't forget restart Apache.

  • # pkill httpd
  • # /opt/coolstack/apache2/bin/httpd


SAI Moodle on Solaris

I just made a special DVD for Moodle with SAI (Sun Academic Initiative) courses on Solaris. Here is the screenshot.


It is very easy to deploy. With this DVD, you just need do these step as the following.

Part 1. Setup Cool Stack (Apache, MySQL and PHP)

1. Create group and user for MySQL
# groupadd mysql
# useradd -G mysql mysql

2. pkgadd Cool Stack (Apache HTTP Server 2.2.3, MySQL 5.0.33 and PHP 5.2.0)
# pkgadd -d CSKamp_x86.pkg
Cool Stack will be installed to the folder of /opt/coolstack

3. Create "my.cnf" in /etc with the following content
[mysqld]
basedir=/opt/coolstack/mysql_32bit
datadir=/opt/coolstack/mysql_32bit/data

4. Run MySQL post-install, create database repository
# cd /opt/coolstack/mysql_32bit/bin
# ./mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

5. Start MySQL
# cd /opt/coolstack/mysql_32bit/bin
# ./mysqld_safe --defaults-file=/etc/my.cnf --user=mysql

6. Change MySQL root password
# /opt/coolstack/mysql_32bit/bin/mysqladmin -u root password 'rootpassword'

7. Run MySQL client in command line
# /opt/coolstack/mysql_32bit/bin/mysql -p
password: rootpassword

8. Edit /opt/coolstack/apache2/conf/httpd.conf
# gedit /opt/coolstack/apache2/conf/httpd.conf

Change index page.
<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

9. Start Apache
#/opt/coolstack/apache2/bin/httpd

Part 2. Setup Moodle with SAI

1. Unzip moodledata.zip to /opt/coolstack/apache2/, and change authorization.
# chmod -R 777 moodledata
# chown -R noaccess moodledata

2. Unzip moodle.zip to /opt/coolstack/apache2/htdocs/, and change authorization.
# chmod -R 777 moodle
# chown -R noaccess moodle

3. Unzip mysql.zip to /opt/coolstack/mysql_32bit/data/, and change authorization.
# chmod -R 777 moodle
# chown -R noaccess moodle

4. Change setting in /opt/coolstack/apache2/htdocs/moodle/config.php
$CFG->wwwroot = 'http://YourServerIPAddress/moodle';

5. Moodle can import SAI courses with SCORM standard very easily.
If you meet errors, please change the filename "imsmanifest_\*\*\*.xml" to imsmanifest.xml in SAI course ZIP bundle.

If you also need this DVD, please mail me.


Dtrace Demo


Hithis is Dtrace Demo, we can use it in our tech talk. I find these information on Hands_on_lab 9520_solaris10dtrace.
Firstly, we can introduce what is Dtrace:
DTrace is a comprehensive dynamic tracing framework for the Solaris Operating Environment. DTrace provides a powerful infrastructure to permit administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.
There are some background information:
Solaris 10 introduced a new dynamic tracing framework called DTrace.
DTrace allows you to dynamically instrument a live running system to collect any arbitrary information from any arbitrary location in the kernel and applications running in a Solaris 10 system.
DTrace defines trace points called probes which could be turned on and off dynamically.
There are close to 50000 probes defined in a Solaris 10 system.
Secondly, we can give some base command line:
We open a terminal and type command
l
et's list the probes that are available on your system.
# dtrace –l
To find the number of probes in your system, pipe the above command
# dtrace -l | wc –l
list the probes in the sysinfo provider type the following command.
# dtrace -l -P sysinfo | more
To list the probes with the name start type the following
# dtrace -l -n start
After that, we can introduce some base knowledge of Dtrace:
D - Internal ID of the probe listed.
Provider - Name of the Provider. Providers are used to classify the probes. This is also the method of instrumentation.
Module - The name of the Unix module or application library of the probe
Function - The name of the function in which the probe exists.
Name - The name of the probe.
Of course, probes can be listed based on the provider or module or function or name.  You can specify the following options with -l option.
-P for provider
-m for module
-f for function
-n for name
Thirdly, we will introduce Dtrace language and list two demos to tell how to use it:
This is the structure of a D script
probe-description
             /predicate/
             {
                   action statements
             }

             probe-description - probe(s) that you want to instrument
             predicate -  filter to limit the execution of action statements
             action - the statements that collect system state.
Probe-description contains 4 attributes:
      provider - name of the provider ex., pid, syscall, io etc...
      module - name of kernel module or lib name ex. ufs, libc, a.out
      function - name of the function ex. open, close, strcmp
      name - name of the probe. ex. entry, return, start
Let's see the construct of the probe-description
Any one of the attribute can be left out and it will match all possible probes.
Wild card like \* and ? can be used in any attribute. Example
     
syscall:::entry - probe describe entry into all syscall
      syscall::open\*:entry - probe matches open and open64 syscall
We will write a simple D-script to instrument the system call subsytem to print the name of the system calls that are happening in the system. We will also print the name and process id of the application that is making the system call.
      
Use syscall:::entry as the probe-description
      
Leave the predicate part empty
      
In the action section add printf statement to print the builtin variables probefunc,pid and execname 
Here is how your syscall.d should look like
syscall:::entry
{
      printf("%s(%d) called %s\\n", execname, pid, probefunc);
}
Now lets modify the code to only print the system calls made by 'java'
Copy syscall.d to java_syscall.d
Add a predicate to limit for execname == "java"
Modify the printf statement to print the process id (pid)
Here is how java_syscall.d should look like
syscall:::entry
/execname == "java"/
{
          printf("Java(%d) called syscall %s\\n", pid, probefunc);
}
Fourly, we will introduce Dtrace Aggregate and give a simple demo:
l  dtrace has a first class data structure called aggregate that helps you in collecting and  processing the data in one step thus dramatically reducing collection cost.
The syntax of aggregate
             @name[key] = aggfunc(args)          
                @
            symbol signifies the aggregate
                name:      optional name of  the aggregate
                key:         optional index of the aggregate
                aggfunc   one of the following
                         count():         count of the event
                         sum(exp):      running total of expression
                         avg(exp):       average of expression
                         min(exp):       min of the given expression
                         max(exp):      max of the expression
                         quantize(exp)a graph of distribution of expression
l  There is a example of aggregate
Use sysinfo:::pswitch as the probe-description
Leave the predicate part empty
In the action section add an aggregate to count the number of signals that are sent using the aggregate statement
@[execname]=count()
Here is how your count_signals.d should look like.
sysinfo:::pswitch
       {
            @[execname]=count();
       }
Run the script that you just wrote
# dtrace -qs count_switch.d  <press Ctrl c after a few seconds>
At last, we will introduce some demos about Dtrace in Java
We will now use DTrace to monitor Class loading, thread creation/destruction & method compilation.
The Classloader probe provide ways to monitor classloading and unloading
The threads probes will allow us to monitor thread creation and deletion
l  First cd to jdk1.6.0/demo/plugin/jfc/Java2D and start the demo app by typing in java -jar Java2Demo.jar
l  Open another window to run the DTrace scripts.
l  We will start with a very simple script to print the creation of new thread. Create a file hotspot_threads.d and type the following into the file.
hotspot$target:::thread-start
{
        printf("New thread with thread id %d started\\n", args[2]);
}
The $target variable is the process id passed to the script through the -p option.
The thread-start probe fires when a new thread is created. This script should print when a new thread is created.
run the script as below.
dtrace -qs hotspot_threads.d -p 1234
You can get the Java2Demo to create threads by clicking on one of the demo tabs.
l  Modify the hotspot_threads.d to include thread destruction and also print the name of the thread. You can use the following code for the exercise. This is hotspot_threads_optional.d
hotspot$target:::thread-start
{
        printf("Thread \\"%s\\" with Thread id %d started\\n",copyinstr(arg0,arg1), args[2]);
}
hotspot$target:::thread-stop
{
        printf("Thread \\"%s\\" with Thread id %d stopped\\n",copyinstr(arg0,arg1), args[2]);
}
l  We will now look at a script to monitor classloading. Create a file hotspot_cload.d and type the the following into the file.
hotspot$target:::class-loaded
{
        printf("%s loaded\\n", copyinstr(arg0,arg1));
}
Click on a tab in the demo window to cause class loading
l  We can use the DTrace to monitor method compilation events as well. Create a file hotspot_compiles.d and type the following...
hotspot$target:::method-compile-begin
{
       printf("Compilation of %s:%s started\\n", copyinstr(arg2,arg3), copyinstr(arg4,arg5));
}
So after we talk the tech in these steps, we can give students a simple introduction of Dtrace. Hope you will like the demo.

星期二 四月 22, 2008

Believe that Solaris will be better(Thinkpad R61i)

These days,i try to install compiz fusion and some drivers of my notebook,but unfortunely i can't find fit resources at the present.However there are some ways to find your own Solaris resources for your notebook.


The 3D desktop is so amazing that i want to install my notebook.But my display card is intel X3100.These day ,i find Erwann has resolved the Nvidia and ATI display card driver problems of compiz for Solaris,you can find these information on blog:http://blogs.sun.com/erwann/.However,after i install the compiz on my notebook Lennovo Thinkpad R61i,the intel X3100 is not compatible with compiz and once you run compiz,the system will be hanged.I find intel X3100 is in compiz blacklist,so hope the new compiz driver of intel X3100 will come out quickly.


Before we install the solaris, we don't know whether our machine is compatible with Solaris.Some days ago,my mentor Fiona Duan gave me some resources of Sun Device Detection Tool.That's a great tool to know some information between your machine and Solaris and you can detect your machine online.This is the website:http://www.sun.com/bigadmin/hcl/hcts/device_detect.jsp.After you detect the system,it will provide some information on your system and some websites where you can find useful drivers.My Lenovo Thinkpad R61i uses the intel chipest and broadcom Netlink.So there are a driver of intel audio on http://www.opensound.com and bcm5787 for Solaris,you can use the driver bcm9\*.. on http://zh-cn.broadcom.com/support/ethernet_nic/?source=top to recognize the network card.


I believe Solaris are changing better and better.Hope you can find some useful resources through above.

星期五 四月 18, 2008

Solaris x86 B80 on HP520(KD074AA)

I have recently installed Solaris x86 B80 on HP520(KD074) which with Intel 945GM, memory of 512MB(have added to 1.5G), Graphics card of Intel 950MA.


1. Install Solaris B80:


       Solaris x86 B80 provides two editions of Solaris Express Developer Edition and Solaris Express. The differences between them are the Solaris Express Developer Edition will install some development tools automaticlly, such as NetBeans and SunStudio.


       HP520 can not install Solaris Express Developer Edition because the graphics card in HP520 cannot be recognised automaticlly, we can install Solaris Express and complete it with configuation step by step. But we found that we can not enter to Java Desktop System.


 


2. Graphics Driver


       There are two methods to deal with the problem of JDS:


1)     1.  Changed to Xsun Server


Solaris adopts Xorg server default to display the graphics, but we can change to Xsun server:


# kdmconfig


              We can Choose the Xsun server and the graphics driver with Xfree-86 default, then reboot after configuration and we can enter the JDS. But the Screen resolution can not be changed in this mode.


2)     2.  Choose other driver of Solaris


Choose the new driver by configuring the Xorg with:


# /usr/X11/bin/xorgconfig


See the configuration details at:


http://wiki.gceclub.sun.com.cn/index.php/%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AEXorg%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%3F


In the graphics driver we choose the VESA generic driver(number 0), after configuration we reboot and enter the JDS.


But the VESA driver can not support the 3D display and OpenGL, it is need to find the other suitable driver.


 


3. Audio Driver


       The audio card also can not word after installation. There are two drivers to be solve the problem:


1)     1. OSS Driver


The OSS driver can support the most aduio card in Solaris, we can download the drivers from http://www.opensound.com/solaris.html.


Unzip the download files to pkg file and steup with ‘pkgadd -d’.


2)      2.Audio Driver for solaris


Download the common driver from http://www.tools.de/solaris/audio/beta.


Unzip the download files to pkg file and steup with ‘pkgadd -d


 


Chinese article see:


http://developers.sun.com.cn/blog/BingfengHong/entry/%E5%9C%A8hp520_kd074_%E4%B8%8A%E5%AE%89%E8%A3%85solaris_x86_b80


 

星期四 四月 03, 2008

Configure VNC Server on Solaris

Author: Cai Xiaowu 


Configure vnc server on solaris

[Read More]
About

This is Chinese Functional CA Team Blog. Any suggestion is appreciated.

Search

Archives
« 四月 2014
星期日星期一星期二星期三星期四星期五星期六
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
今天