Jumat, 08 Februari 2008

How to create rawdevices on Linux (Redhat, Fedora, CentOS)

How to create rawdevices (without LVM)

1. Run command fdisk, example on /dev/sdc partition
# fdisk /dev/sdc
---------------------
Command (m for help):
---------------------

2. Create 'Extended' partiton for rawdevices
------------------------------------------------------------------------
Command (m for help): n ---------------> push 'n' button to add partition
Command action
e extended
p primary partition (1-4)
e ------------------------------------> push 'e' button
Partition number (1-4): 1 -------------> choose 1
First cylinder (1-19448, default 1): --> push enter button
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19448, default 19448):
---------------------------------------> push enter button
Using default value 19448

Command (m for help):
------------------------------------------------------------------------

3. Here are the partition layout:
------------------------------------------------------------------------
Command (m for help): p

Disk /dev/sdc: 159.9 GB, 159965315072 bytes
255 heads, 63 sectors/track, 19448 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 19448 156216028+ 5 Extended

Command (m for help):
------------------------------------------------------------------------
We can see that /dev/sdc1 has 156216028 free blocks, begin from 1 to 19448

4. Now create logical partition from extended

-----------------------------------------------------------------------
Command (m for help): n ------------> push 'n' button
Command action
l logical (5 or over)
p primary partition (1-4)
l ----------------------------------> push 'l'
First cylinder (1-19448, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19448, default 19448): +2000M --------> it's means we create 2G partiton size

Command (m for help):
-----------------------------------------------------------------------

5. Change id system
-----------------------------------------------------------------------
Command (m for help): t ---------> push 't' to change id
Partition number (1-5): 5 -------> usually begin from 5
Hex code (type L to list codes): 60 --> give code 60
Changed system type of partition 5 to 60 (Unknown)

Command (m for help):
-----------------------------------------------------------------------

6. Click 'w' untuk to save partition

Command (m for help): W

7. Then use administration toos to setup raw devices on redhat distro, usually at /etc/sysconfig/rawdevices file.

# vi /etc/sysconfig/rawdevices

then add script below:

/dev/raw/raw1 /dev/sdc5

8. bind the raw devices by restart rawdevices services:
# /etc/rc.d/init.d/rawdevices start

9. Automaticaly rawdevices up when the system reboot:

# chkconfig rawdevices on

or use command 'ntsysv' then ceck 'rawdevices' part

10.To view rawdevices settings, run this command:
# raw -qa


rawdevices using LVM

1. Run fdisk command, example on /dev/sdc partition:
# fdisk /dev/sdc
---------------------
Command (m for help):
---------------------

2. Create 'primary partition' for LVM rawdevices
------------------------------------------------------------------------
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19448, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19448, default 19448):
Using default value 19448

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)

Command (m for help): p

Disk /dev/sdc: 159.9 GB, 159965315072 bytes
255 heads, 63 sectors/track, 19448 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 19448 156216028+ 8e Linux LVM
------------------------------------------------------------------------

3. Crate Physical Volume at /dev/sdc1

# pvcreate /dev/sdc1

4. Crate Volume Grup vg01 at /dev/sdc1

# vgcreate vg01 /dev/sdc1

5. Create Logical Volume , example:

# lvcreate -L 2000M -n lvol1 vg01
--> create 2G logical volume sebesar named lvol1 on vg01
--> we will see /dev/vg01/lvol1 file on our systems

6. Edit /etc/sysconfig/rawdevices file, then add script below:

# vi /etc/sysconfig/rawdevices

/dev/raw/raw1 /dev/vg01/lvol1

7. Start rawdevices

# /etc/rc.d/init.d/rawdevices start

8. Automaticaly rawdevices up when the system reboot:

# chkconfig rawdevices on

9. To view rawdevices settings, run this command:

# raw -qa


--
yeah....it's easy !

Tidak ada komentar: