Friday 29 January 2016

[Linux] How to Increase the size of LVM by adding a new disk

1. Check New Disk Device

fdisk -l


2. Create Partition

  2.1. Select Device
fdisk /dev/xvdb

  2.2. New Partition
Command (m for help): n

  2.3. Continue...
Command action
   e   extended
   p   primary partition (1-4)
p

Partition number (1-4): 1

First cylinder (1-2610, default 1): (enter)
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): (enter)

  2.4. Change to a partitions system ID
Command (m for help): t
Selected partition 1

Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

  2.5. Save
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

3. Create PV(Physical Volume)

pvcreate /dev/xvdb1



4. Extend VG(Volume Group)
vgdisplay


vgextend VolGroup /dev/xvdb1


pvscan


5. Extend LV(Logical Volume)

lvdisplay
































lvextend /dev/VolGroup/lv_home /dev/xvdb1


6. Resize File System

resize2fs /dev/VolGroup/lv_home




Before Extention



After Extention



[Xen] How to Add Hard Disk as Storage Repository Using XE Command

1. Check New Hard Disk

fdisk -l











2. Create SR

xe sr-create name-label=<Name of Storage> shared=false device-config:device=<Path of the Storage device> type=lvm


this command returns Storage Repository UUID.

[CentOS] /etc/sysconfig/network

The /etc/sysconfig/network file is used to specify information about the desired network configuration. The following values may be used:

NETWORKING=<value>
    where <value> is one of the following boolean values:
yes — Networking should be configured.
no — Networking should not be configured.

HOSTNAME=<value>
  where <value> should be the Fully Qualified Domain Name (FQDN), such as hostname.expample.com, but can be whatever hostname is necessary.

GATEWAY=<value>
    where <value> is the IP address of the network's gateway.

GATEWAYDEV=<value>
    where <value> is the gateway device, such as eth0. Configure this option if you have multiple interfaces on the same subnet, and require one of those interfaces to be the preferred route to the default gateway.

NISDOMAIN=<value>
    where <value> is the NIS domain name.

NOZEROCONF=<value>
    where setting <value> to true disables the zeroconf route.

[Java] When Command in Runtime.getRuntime().exec is Not Working

try {
    Runtime.getRuntime().exec( "echo Hello > test.txt");

} catch ( IOException e) {
    e.printStackTrace();
}

If does not occur Exception and command is not working,

For Linux
try {
    Runtime.getRuntime().exec( new String[] { "/bin/sh", "-c", "echo Hello > test.txt"});

} catch ( IOException e) {
    e.printStackTrace();
}
For Windows
try {
    Runtime.getRuntime().exec( new String[] { "cmd.exe", "/c", "echo Hello > test.txt"});

} catch ( IOException e) {
    e.printStackTrace();
}

Friday 22 January 2016

[RCP] How to set workspace location in Eclipse RCP (이클립스 RCP Workspace 설정)

Eclipse Framework은 Workspace location에 Framework에 필요한 다양한 정보들은 저장 및 로드한다. Eclipse RCP에서는 workspace location을 명시적으로 설정을 하지 않을 경우, User Directoryprogram 내에서 설정하기 위해서는
소스에서

In my Eclipse / RCP application the .metadata directory was always created in the working directory. This worked fine when I was opening the application normally.

However, I needed file associations, so the user can just double click on file somewhere on his computer and open the file.

If you do this, the working directory is set to the directory where the file is located. This resulted in the creation of a .metadata directy at the same location. Brrr...

Since I dont like the creation of .metadata in the working directory either, because thats usually the application folder and not writeable, this needed to be addressed anyway.

So I looked for a solution to change the workspace location for the application.

To achieve this, two steps are neccessary. First we add an additional parameter in the Run configuration:

The paramater is -data @noDefault and makes it possible for us to set up our own location.

Which we do in the *Application class of our application:



[ActiveMQ] Destination Wildcards

ActiveMQ에서는 계층적으로 Destination(Queue 또는 Topic)의 이름을 분리시키는 것을 지원한다.

[JDBC] java.sql.Types List

java.sql.Types Value
java.sql.Types.ARRAY 2003
java.sql.Types.BIGINT -5
java.sql.Types.BINARY -2
java.sql.Types.BIT -7
java.sql.Types.BLOB 2004
java.sql.Types.BOOLEAN 16
java.sql.Types.CHAR 1
java.sql.Types.CLOB 2005
java.sql.Types.DATALINK 70
java.sql.Types.DATE 91
java.sql.Types.DECIMAL 3
java.sql.Types.DISTINCT 2001
java.sql.Types.DOUBLE 8
java.sql.Types.FLOAT 6
java.sql.Types.INTEGER 4
java.sql.Types.JAVA_OBJECT 2000
java.sql.Types.LONGNVARCHAR -16
java.sql.Types.LONGVARBINARY -4
java.sql.Types.LONGVARCHAR -1
java.sql.Types.NCHAR -15
java.sql.Types.NCLOB 2011
java.sql.Types.NULL 0
java.sql.Types.NUMERIC 2
java.sql.Types.NVARCHAR -9
java.sql.Types.OTHER 1111
java.sql.Types.REAL 7
java.sql.Types.REF 2006
java.sql.Types.ROWID -8
java.sql.Types.SMALLINT 5
java.sql.Types.SQLXML 2009
java.sql.Types.STRUCT 2002
java.sql.Types.TIME 92
java.sql.Types.TIMESTAMP 93
java.sql.Types.TINYINT -6
java.sql.Types.VARBINARY -3
java.sql.Types.VARCHAR 12