CentOS下添加新硬盤并分區(qū)格式化的詳細步驟

下面看我·操作的步驟:
1.先用Fdisk -l 來查看當(dāng)前狀態(tài)下磁盤情況
[root@linux1 ~]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 652 5132767 8e Linux LVM
Disk /dev/hdb: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk /dev/hdb doesn't contain a valid partition table
上面紅色標識行可以看出,我添加了一塊新硬盤/dev/hdb,大小為2G,未分區(qū)格式化狀態(tài)。
2.用Fdisk /dev/hdb來進行分區(qū)操作。
[root@linux1 ~]# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
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.
The number of cylinders for this disk is set to 4161.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n //輸入N表示新建一個分區(qū)
Command action
e extended
p primary partition (1-4)
p //p 表示建立一個原始分區(qū)
Partition number (1-4): 1 //1 表示此分區(qū)編號為1.
First cylinder (1-4161, default 1): 1 //1表示使用默認起始柱面號.如果要分多個區(qū)的話,先盤算好要多大,再輸入數(shù)字
Last cylinder or size or sizeM or sizeK (1-4161, default 4161): // 輸入: 回車 表示使用默認結(jié)束柱面號.即此分區(qū)使用整個硬盤空間
Using default value 4161
Command (m for help): w //保存分區(qū)
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3.再次查看當(dāng)前分區(qū)狀態(tài):
[root@linux1 ~]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 652 5132767 8e Linux LVM
Disk /dev/hdb: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 4161 2097112 83 Linux
可以看出,已經(jīng)出來了一個/dev/hdb1的新分區(qū)。下一步將其格式化,再使用
4.用mkfs.ext3格式化新分區(qū)
[root@linux1 ~]# mkfs.ext3 /dev/hdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524278 blocks
26213 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
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5.掛載使用。
[root@linux1 ~]# mkdir /mnt/hdb1 //新建一個掛載點。
[root@linux1 ~]# mount /dev/hdb1 /mnt/hdb1 //掛載。
[root@linux1 ~]# df -h
文件系統(tǒng) 容量 已用 可用 已用% 掛載點
/dev/mapper/VolGroup00-LogVol00
4.3G 3.6G 487M 89% /
/dev/hda1 99M 12M 82M 13% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/hdb1 2.0G 3.0M 1.9G 1% /mnt/hdb1
6 .開機自動掛載
三.設(shè)置新硬盤開機自動掛載
在vi /etc/fstab中添加新硬盤的掛載信息.添加下面一行:
/dev/hdb1 /mnt/hdb1 ext3 defaults 1 2(如果還有一個分區(qū)就是1 3,以此類推)
這樣,每次開機后,系統(tǒng)會自動將/dev/hdb1掛載到/mnt/hdb1
相關(guān)文章
- 在經(jīng)歷了兩次跳票以后, Red Hat于2007年3月14日正式發(fā)布了RHEL5. RHEL 5將是Red Hat的商業(yè)服務(wù)器操作系統(tǒng)版本的第四次重要版本發(fā)布, Red Hat醞釀發(fā)布RHEL 5已經(jīng)超過了兩年,2008-09-08
- vi編輯器是所有Unix及Linux系統(tǒng)下標準的編輯器,它的強大不遜色于任何最新的文本 編輯器,這里只是簡單地介紹一下它的用法和一小部分指令。由于對Unix及Linux系統(tǒng)的任2008-09-08
CentOS安裝rpm包時遇到Header V3 DSA signature: NOKEY時解決辦法
linux/centos Header V3 DSA signature: NOKEY, key ID 錯誤解決方法,需要的朋友可以參考下。2010-10-17- 本文為大家介紹在CentOS-6.3中安裝與配置Tomcat-7的方法,有需要的朋友可以參考下2013-02-07
- 本文中為大家介紹的是在centos6中添加一塊新的硬盤并對它進行分區(qū)的方法,想了解的朋友可以閱讀本文參考2014-01-02
CentOS 6.3 NFS的安裝配置、啟動及mount掛載方法
這篇文章主要介紹CentOS 6.3 NFS的安裝配置、啟動及mount掛載方法,特分享下,方便需要的朋友2013-04-11CentOS網(wǎng)絡(luò)配置后無法訪問外網(wǎng)的解決方法
今天在按照Mitchell博客之前的CentOS網(wǎng)絡(luò)配置的文章配置Linux網(wǎng)卡之后,發(fā)現(xiàn)竟然ping不通外網(wǎng),但是內(nèi)網(wǎng)ping卻是正常的。一直很納悶,在網(wǎng)上搜索很久也沒有得到答案2014-04-20- 用Linux ifconfig命令配置的網(wǎng)卡信息,在網(wǎng)卡重啟后機器重啟后,配置就不存在。要想將下述的配置信息永遠的存的電腦里,那就要修改網(wǎng)卡的配置文件了2012-10-22
Linux系統(tǒng)下如何掛載U盤,硬盤,光驅(qū)
一.Linux掛載U盤: 1、插u盤到計算機,如果目前只一個u盤而且你的硬盤不是scsi的硬盤接口的話,那它的硬件名稱為:sda1, 2、在mnt目錄下先建立一個usb的目錄(如:[root@2008-09-08centos 7 安裝percona Server 服務(wù)器方法
本文將為大家具體的講解centos 安裝percona,了解 Percona 服務(wù)器,Percona Server為 MySQL 數(shù)據(jù)庫服務(wù)器進行了改進,在功能和性能上較 MySQL 有著很顯著的提升2016-11-24