Pages

Monday 8 December 2014

Networking Courses in Chennai 

SAKTHI SOFTWARE SOLUTIONS

Final Year Projects - 2014
RVR Towers, 1st Street, 3rd Main Road, Annanagar, Behind Nalli Silks, 
Chennai 600 040,Tel: 044-43016888 / 9710780469 Email: fresherfocus@gmail.com, sssprojects2013@gmail.com 

Adding a Disk in Linux

The Linux operating system, we need to add a separate new disk for some specific project and also increase space limitation. It's easy to add a disk in Vmware, but we must partition and format the newly added disk as linux administrator(root). Following steps explain how to format the disk in linux.

Step 1:

Create a Disk in VMware

Step 2 :

Start the Virtual Machine

Step 3 :

Login as root and open a terminal window.
Use fdisk -l to list the hard drives.

[root@oraclehost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 650 5116702+ 82 Linux swap / Solaris
/dev/sda3 651 1032 3068415 83 Linux
/dev/sda4 1033 2610 12675285 5 Extended
/dev/sda5 1033 2610 12675253+ 83 Linux

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Step 4:

Disk /dev/sdb doesn't contain a valid partition table. so first formating /dev/sdb is the new device that should be mounted. Create partitions in /dev/sdb as given below.
[root@oraclehost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklable
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux

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

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

Step 5:

Create a filesystem for the disk (ext3)
[root@oraclehost ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524112 blocks
26205 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done 
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

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

Step 6:

Then mount the disk to /u01
[root@oraclehost ~]# mkdir /u01
[root@oraclehost ~]# mount -t ext3 /dev/sdb1 /u01
[root@oraclehost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 12G 3.5G 7.7G 32% /
/dev/sda3 2.9G 72M 2.7G 3% /tmp
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 221G 18G 204G 8% /mnt/hgfs
/dev/sdb1 2.0G 36M 1.9G 2% /u01

Step 7:

To mount the disk automatically after reboot, add a entry in fstab like
[root@oraclehost ~]# vi /etc/fstab
[root@oraclehost ~]# cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /u01 ext3 defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0

To check the entry in fstab , umount and remount the disk.
[root@oraclehost ~]# umount /u01
[root@oraclehost ~]# mount -a
[root@oraclehost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 12G 3.5G 7.7G 32% /
/dev/sda3 2.9G 72M 2.7G 3% /tmp
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 221G 18G 204G 8% /mnt/hgfs
/dev/sdb1 2.0G 36M 1.9G 2% /u01



No comments:

Post a Comment