2017年1月2日 星期一

[Linux 文章收集] Linux Hard Disk Format Command

Source From Here 
Question 
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? 

How-To 
There are total 4 steps involved for hard disk upgrade and installation procedure: 
Step #1 : Partition the new disk using fdisk command 
# fdisk -l | grep '^Disk'
...
Disk /dev/sdb: 240.1 GB, 240057409536 bytes, 468862128 sectors

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 mkfs.ext3 on the new disk: 
# mkfs.ext3 /dev/sdb

Step#3 : Mount the new disk using mount command 
First create a mount point /disk1 and use mount command to mount /dev/sdb, enter: 
# mkdir /disk1
# mount /dev/sdb /disk1
# df -H /disk1 // Check the disk is mounted and show disk usage

Step#4 : Update /etc/fstab file 
Edit /etc/fstab file, enter: 
# vi /etc/fstab
  1. /dev/sdb               /disk1           ext3    defaults        0 0  

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/sdb /backup

You can use label name insted of partition name to mount disk using /etc/fstab
  1. LABEL=/backup /disk1 ext3 defaults 0 0  
Supplement 
VBird - Linux 磁碟與檔案系統管理

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...