国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

Linux 添加新硬盤

2024-06-28 13:23:15
字體:
供稿:網(wǎng)友
linux 添加新硬盤1.識別分區(qū)和硬盤

在 /dev/ 目錄下找到新的硬盤,sda 為本地硬盤,sda1、sda2.. 為分區(qū),sdb 就是新添加的硬盤,如:

[root@wusuyuan ~]# ls -ltr /dev/sd*
brw-rw----. 1 root disk 8,  0 11月 14 14:12 /dev/sda
brw-rw----. 1 root disk 8,  3 11月 14 14:12 /dev/sda3
brw-rw----. 1 root disk 8,  2 11月 14 14:12 /dev/sda2
brw-rw----. 1 root disk 8,  1 11月 14 14:12 /dev/sda1
brw-rw----. 1 root disk 8, 16 11月 14 14:12 /dev/sdb

學(xué)習(xí)的機(jī)器為虛擬機(jī),與真實(shí)的物理機(jī)器略有不同,真實(shí)的物理機(jī)器根據(jù)硬盤接口類型(IDE、SATA、SCSI、光纖通道和SAS)可能為hda、sda或其它的名稱。

2.新硬盤分區(qū)

使用管理員權(quán)限對新的硬盤 /dev/sdb 分區(qū):

[root@wusuyuan ~]# fdisk /dev/sdb   ####進(jìn)入分區(qū)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb7ee5a9d.
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)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): m   #### 查詢幫助
Command action
   a   toggle a bootable flag 
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): n   ####創(chuàng)建新的分區(qū)
Command action
   e   extended
   p   primary partition (1-4)
e   ####選擇分區(qū)類型(擴(kuò)展分區(qū)、主分區(qū))
Partition number (1-4): 1  ####分區(qū)數(shù),這里分1個區(qū)
First cylinder (1-2610, default 1): 2610  ####這里輸入分區(qū)大小,默認(rèn)單位為mb
Command (m for help): p ####查看分區(qū)表信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x35b64cad
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2610        2610        8032+   5  Extended
Command (m for help): w ####寫入分區(qū)信息,如果未確定或想取消,輸入q退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

在寫入分區(qū)信息時(shí)要仔細(xì)核對和確認(rèn),寫入分區(qū)信息后不可再更改。 分區(qū)完成后,新的硬盤還是不能使用的,需要進(jìn)行格式化。

3.使用mkfs進(jìn)行格式化硬盤分區(qū)
[sywu@wusuyuan ~]$ mkfs
Usage: mkfs [-V] [-t fstype] [fs-options] device [size]
 #-t 格式化分區(qū)類型,如 ext3、ext4
[root@wusuyuan ~]# mkfs -t ext4 /dev/sdb  #對分區(qū)進(jìn)行格式化,類型為ext4
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
無論如何也要繼續(xù)? (y,n) y
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
第一個數(shù)據(jù)塊=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
正在寫入inode表: 完成                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 
完成
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

分區(qū)格式化完成后使用mount 命令裝載新的分區(qū):

[root@wusuyuan ~]# mount /dev/sdb /disk2 #裝載分區(qū) 
[root@wusuyuan ~]# df -h  #查詢分區(qū)
文件系統(tǒng)              容量  已用  可用 已用%% 掛載點(diǎn)
/dev/sda2              97G  9.9G   82G  11% /
tmpfs                 1.9G  200M  1.7G  11% /dev/shm
/dev/sda1             194M   52M  133M  28% /boot
/dev/sdb               20G  1.9G   17G  11% /disk2
4.配置新的分區(qū)自動裝載
在/etc/fstab 中配置分區(qū)自動裝載
[root@wusuyuan ~]# vim /etc/fstab #
# /etc/fstab
# Created by anaconda on Sun Jan  5 08:17:56 2014
#
# accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9c738ca5-810a-46ec-b896-57fc8286b2a5 /                       ext4    defaults        1 1
UUID=05b44d26-bd3a-4688-81e1-c83da70512a7 /boot                   ext4    defaults        1 2
UUID=7146f132-f77b-4a17-8686-d7c9c9be10ad swap                    swap    defaults        0 0
                                        
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/sdb                /disk2                 ext4     defaults        1 2 #加入新的分區(qū)信息

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 渭源县| 吴江市| 北票市| 容城县| 西藏| 弋阳县| 阿拉善左旗| 昆山市| 仪陇县| 江都市| 瑞金市| 沧州市| 潜江市| 体育| 宿松县| 疏勒县| 通辽市| 阿拉善右旗| 淮阳县| 洛隆县| 绿春县| 湛江市| 兴宁市| 香港 | 武邑县| 谷城县| 奉节县| 元谋县| 南乐县| 延寿县| 称多县| 神池县| 瑞安市| 凭祥市| 景泰县| 乌海市| 嘉黎县| 淮阳县| 哈巴河县| 蕉岭县| 江城|