Tuesday, October 2, 2012

Linux Hard Disk Format Command

Step #1 : Partition the new disk using fdisk command

list all detected hard disks:
# fdisk -l | grep '^Disk'

Disk /dev/sda: 251.0 GB, 251000193024 bytes
Disk /dev/sdb: 251.0 GB, 251000193024 bytes
A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings.
To partition the disk - /dev/sdb, enter:

# fdisk /dev/sdb
Step#2 : Format the new disk using mkfs.ext3 command
To format Linux partitions using ext2fs on the new disk:
# mkfs.ext3 /dev/sdb1

Step#3 : Mount the new disk using mount command

create a mount point /disk1 and use mount command to mount /dev/sdb1, enter:
# mkdir /disk1
# mount /dev/sdb1 /disk1
# df -H

Step#4 : Update /etc/fstab file

Open /etc/fstab file, enter:
# vi /etc/fstab
Append as follows:
/dev/sdb1               /disk1           ext3    defaults        1 2
Save and close the file.

Task: Label the partition

You can use label name insted of partition name to mount disk using /etc/fstab:
LABEL=/backup /disk1 ext3 defaults 1 2

ref: http://www.cyberciti.biz/faq/linux-disk-format/

No comments:

Post a Comment


Check Page Rank of your Web site pages instantly:

This page rank checking tool is powered by Page Rank Checker service