Linux Hard Disk Format Command
2009-08-04 17:15
423 查看
Q. I've installed a new 250GB SATA hard disk on our office CentOS Linux server. How do I format a hard disk under Linux operating system from a shell prompt?
A.. There are total 4 steps involved for hard disk upgrade and installation procedure: Step #1 : Partition the new disk using fdisk command Following command will list all detected hard disks:
# fdisk -l | grep '^Disk'
Output: 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
The basic fdisk commands you need are:
m - print help
p - print the partition table
n - create a new partition
d - delete a partition
q - quit without saving changes
w - write the new partition table and exit
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
First 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 label the partition using e2label. For example, if you want to label the new partition /backup, enter
# e2label /dev/sdb1 /backup
You can use label name insted of partition name to mount disk using /etc/fstab:
LABEL=/backup /disk1 ext3 defaults 1 2
A.. There are total 4 steps involved for hard disk upgrade and installation procedure: Step #1 : Partition the new disk using fdisk command Following command will list all detected hard disks:
# fdisk -l | grep '^Disk'
Output: 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
The basic fdisk commands you need are:
m - print help
p - print the partition table
n - create a new partition
d - delete a partition
q - quit without saving changes
w - write the new partition table and exit
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
First 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 label the partition using e2label. For example, if you want to label the new partition /backup, enter
# e2label /dev/sdb1 /backup
You can use label name insted of partition name to mount disk using /etc/fstab:
LABEL=/backup /disk1 ext3 defaults 1 2
相关文章推荐
- Linux Hard Disk Format Command
- Linux Hard Disk Format Command
- Linux Hard Disk Format Command
- Linux Hard Disk Format Command
- Linux fdisk Command Examples to Manage Hard Disk Partition
- Ubuntu - 硬盘分区、格式化、自动挂载配置 | Hard disk add new partition, format, auto mount in ubuntu
- How do I remove all partitions, data and create clean empty hard disk under Linux operating systems?
- how the process using the hard disk in linux
- glance image-create --name "linux-core-mini-01" --file /cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --progress --visibility public
- Ubuntu - 硬盘分区、格式化、自动挂载配置 | Hard disk add new partition, format, auto mount in ubuntu
- indent command - format code under Linux
- lvm add new hard disk for oracle linux 5.8
- Ubuntu - 硬盘分区、格式化、自动挂载配置 | Hard disk add new partition, format, auto mount in ubuntu
- UEFI+GPT hard disk install multi linux system
- 不让 A Hard Disk is reporting health problems 困扰你使用linux
- VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!
- VBoxManage.exe: error: Resize hard disk operation for this format is not implemented yet!
- linux disk command
- centos 7 mount usb hard disk(ntfs format)
- Solve Linux & Unix Systems Hard Disk Problems