Friday, 16 September 2011

Redhat Linux – Creating New Partition table and Filesystem on SAN disk


Redhat Linux – Creating New Partition table and Filesystem on SAN disk



procedure to create a new partition table and a file system on a disk (or LUN) under Linux

1. List the available disks / LUNs with the following command:

# fdisk -l



2. Run the fdisk command against the applicable disk you wish to partition. In this instance we use the example sdb which is the second available disk on this platform:

# fdisk /dev/sdb
Replace ‘sdb’ with the device which represents the disk you wish to modify.

3. Type ‘o’ and press enter to create a new, blank, DOS-style partition table. After doing so, you can type ‘p’ to display the blank partition table, which will appear as the following:

Command (m for help): p

Disk /dev/sdb: 9100 MB, 9100044288 bytes
255 heads, 63 sectors/track, 1106 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help):

4. Press ‘n’ and then enter to create a new partition. You will be prompted for several pieces of information including if to create a primary or extended partition (choose primary), which partition number, and how large of a partition to create. The default values will be to create a partition as large as the entire disk:

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1106, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1106, default 1106): 1106
After doing so, ‘p’ should show a single partition occupying the entire disk:

Command (m for help): p

Disk /dev/sdb: 9100 MB, 9100044288 bytes
255 heads, 63 sectors/track, 1106 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1106 8883913+ 83 Linux

5. Write out the changes to the disk by pressing ‘w’ and then enter. This will cause fdisk to exit and return to the command prompt. The command ‘partprobe’ should then be run, or the system restarted, to ensure that the kernel is notified of any partition table changes.

6. A file system can then be created using whatever options are desired on the partition.

For example, to create an ext3 file system one would run:

# mkfs.ext3 /dev/sdb1

No comments:

Post a Comment

Twitter Bird Gadget