Sunday, May 26, 2013

RHEL 5 parted command step by step.

To test this we used RHEL 5 n vmware.
1. Add a new SCSI type hard disk
2. vm machine will save it and process for you
3. after may be one minute run fdisk -l as root and see if you can see the disk you created

Disk /dev/sdb: 1073 MB, 1073741824 bytes
81 heads, 26 sectors/track, 995 cylinders
Units = cylinders of 2106 * 512 = 1078272 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         186      195312+  83  Linux
Partition 1 has different physical/logical endings:
     phys=(24, 80, 26) logical=(185, 39, 2)

Now run the command:

[root@smtreeprd04 ~]# parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
Got following error:
(parted) mkpart
Error: Unable to open /dev/sdb - unrecognised disk label.

Lets label the disk:

(parted) mklabel msdos
(parted) mkpart
Partition type?  primary/extended? primary
File system type?  [ext2]?
Start? 1 200
(parted) p

Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      0.51kB  200MB  200MB  primary

Now exit the parted utility and format the partition with mkfs

[root@smtreeprd04 ~]# mke2fs /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
48960 inodes, 195312 blocks
9765 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
24 block groups
8192 blocks per group, 8192 fragments per group
2040 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

create a directory for mount  point

mkdir /sdb1

[root@smtreeprd04 ~]# mount /dev/sdb1 /sdb1/

[root@smtreeprd04 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             5.7G  2.3G  3.2G  43% /
/dev/sda1              99M  9.9M   84M  11% /boot
tmpfs                 506M     0  506M   0% /dev/shm
/dev/sda7             965M   18M  898M   2% /home
/dev/sda6             1.5G   35M  1.4G   3% /opt
/dev/sda2             9.5G  5.4G  3.7G  60% /var
/dev/sdb1             185M  1.6M  174M   1% /sdb1

Thanks.



No comments: