Posts

How to Convert ext2 partition into ext3?

Suppose you want to convert your /tmp partition into ext3 then follow the following step:- 1. # init 1(Single user mode) 2.# umount /tmp or # mount -o remount,rw /tmp 3.# tune2fs -j /dev/sda9(Here /dev/sda9 represent /tmp partition.you must check using fdisk -l command) This command add .journal file into /tmp partition. 4. Open /etc/fstab file change partition type of /tmp into ext3. 5.Now check file system type using following command:- # file -s /dev/sda9 6.# init 6(Restart)

How to Convert ext3 partition into ext2?

Suppose you want to convert your /tmp partition into ext2 then follow the following step:- 1.# init 1(single user mode) 2.# umount /tmp or # mount -o remount,ro /tmp(better choice) 3.# tune2fs -O^has_journal /dev/sda9 (Here /dev/sda9 represent /tmp partition) 4.# e2fsck /dev/sda9 5.# rm -f /tmp/.journal (Removing .journal file) 6.Open /etc/fstab file change partition type of /tmp into ext2. 7.Check partition type of /dev/sda9 using following command:- # file -s /dev/sda9 8.# init 6(Restart)

Create a Partition having size 100MB and mount it on /data

1.# fdisk -l to see the partition table. 2.Now used following command:- # fdisk /dev/sda i>now type n for new partition. ii>It will ask you for primary or logical partition.Press l for logical partition. iii>It will ask for starting cylinder:Use defaults by pressing enter key. iv>Type the size:+100M (You also can specify last cylinder size here) v> Press P to verify partition lists and remember partition name. vi>Press w to write on partition table. 3.# init6 (restart) 4.# mkdir /data(Create a new directory name /data) 5.# mkfs -t ext3 /dev/sda10 (Here /dev/sda10 is a partition name) or # mke2fs -j /dev/sda10 (Create a ext3 partition) 6.Open /etc/fstab file:- write following line:- /dev/sda10 /data ext3 defaults 1 2 (Save the file) 7.# mount /dev/sda10 /data

Few tips for Linux User related to MAN page

To read a man page general command is:- #/$man example :-$man ping The above command gives you a name synopsis and short description about that command , list of option with that command and the author name. it also display ping(8).Here 8 is a section. The manual page categorized into several section. 1 - user commands 2 - System calls 3 - Subroutines 4 - Devices 5 - File Formats 6 - Games 7 - Miscellaneous 8 - System Administrator n - New x - X Window For ubuntu man page configuration file is : /etc/manpath.config for other system (Red Hat) /etc/man.config 1.Search a string with in man page: $man -k command 2.Convert man page to other format(by default post script format) $man -t command suppose you want to convert it into pdf format then $man -t ping|ps2pdf -> ping.pdf 3. Find a command form a particular section:- $man command eg. $man 3 printf 4. Small description(One sentence) about any command. $man -f command eg. $man -f ifconfig

SEND Mail Using JAVA Mail API

You need mail.jar to add your project ----------------------------------------------------- ----------------------------------------------------- import javax.mail.*; import javax.mail.internet.*; import java.util.Properties; public class SimpleSSLMail { private static final String SMTP_HOST_NAME = "smtp.gmail.com"; private static final int SMTP_HOST_PORT = 465; private static final String SMTP_AUTH_USER = "arinengg@gmail.com"; private static final String SMTP_AUTH_PWD = "password"; public static void main(String[] args) throws Exception{ new SimpleSSLMail().test(); } public void test() throws Exception{ Properties props = new Properties(); props.put("mail.transport.protocol", "smtps"); props.put("mail.smtps.host", SMTP_HOST_NAME); props.put("mail.smtps.auth", "true"); Session mailSession = Session.getDefaultInstance(props); mailSession.setDebug(true); Transport transport = mailSession.getTransport(); MimeM

Scrollable RESULTSET

import java.sql.*; public class Arin { public Arin(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://127.0.0.1/Libary","root","password"); Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet rs=st.executeQuery("Select * from idnt"); int i=0; while(rs.next()) i++; System.out.println("Result Set Length:"+i); rs.beforeFirst(); while(rs.next()) System.out.println(""+rs.getString(1)); }catch(Exception e){ System.out.println(e.toString()); } } public static void main(String ar[]){ new Arin(); } }