立即注册 找回密码

QQ登录

只需一步,快速开始

查看: 2852|回复: 0

[Linux主机系统教程] linux下分区、格式化、挂载新硬盘的详细教程

[复制链接]
发表于 2015-5-24 19:34:18 | 显示全部楼层 |阅读模式
道勤网-数据www.daoqin.net

亲注册登录道勤网-可以查看更多帖子内容哦!(包涵精彩图片、文字详情等)请您及时注册登录-www.daoqin.net

您需要 登录 才可以下载或查看,没有账号?立即注册

x

1、# fdisk -l      查看当前磁盘信息,就会发现最下面显示新加入的硬盘不是有效分区,如下:
Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

2、# fdisk /dev/sdc      对新硬盘分区,并根据提示进一步操作
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 182401.
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): h      输入h可查看帮助命令
h: unknown command
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      输入n进行分区
Command action
   e   extended
   p   primary partition (1-4)
p      输入p为主分区,e为逻辑分区
Partition number (1-4): 1      由于是新盘我们输入1来分第一个主分区,共可以分4个主分区
First cylinder (1-182401, default 1):      选择该分区的起始磁盘数,如无特殊需求强烈建议选择默认,也就是1来分区(直接按回车)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-182401, default 182401):      定义该分区的大小,如果按默认(按回车)即是使用全部可用存储额,如分一个1G的空间,输入+1024m
Using default value 182401

Command (m for help): w      写入分区
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

3、# fdisk -l      可以找到我们刚才分的一个分区,内容如下:
Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id System
/dev/sdc1               1      182401 1465136001   83 linux

4、# mkfs -t ext3 -c /dev/sdc1      对分区使用ext3格式化,如多个分区sdc2等以此类推,因为新硬盘加了-c参数要先检测磁盘坏道,此过程万分漫长(150G),等待。。。
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
183156736 inodes, 366284000 blocks
18314200 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
11179 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

5、# mkdir /var/samba      新建挂载目录

6、# mount /dev/sdc1 /var/samba      挂载新硬盘

7、# df -hl      查看分区大小是否和我们预定的一样:
文件系统               容量   已用 可用 已用% 挂载点
/dev/sda7             9.5G 3.2G 5.9G 35% /
/dev/sda6             9.5G 151M 8.9G   2% /tmp
/dev/sda5              19G 3.6G   15G 20% /usr
/dev/sda3              19G 719M   18G   4% /home
/dev/sda2             230G   23G 196G 11% /var
/dev/sda1              99M   25M   69M 27% /boot
/dev/sdb1             233G 156G   78G 67% /var/samba2
tmpfs                1008M     0 1008M   0% /dev/shm
/dev/sdc1             1.4T 198M 1.3T   1% /var/samba      此行为新硬盘

8、# vi /etc/fstab      设置系统自动挂载硬盘,加入一行:
/dev/sdc1               /var/samba2             ext3    defaults        0 0

9、重启服务器,用步骤7检查一下,一切正常挂载完成,祝好运~


道勤主机提供365天*24小时全年全天无休、实时在线、零等待的售后技术支持。竭力为您免费处理您在使用道勤主机过程中所遇到的一切问题! 如果您是道勤主机用户,那么您可以通过QQ【792472177】、售后QQ【59133755】、旺旺【诠释意念】、微信:q792472177免费电话、后台提交工单这些方式联系道勤主机客服! 如果您不是我们的客户也没问题,点击页面最右边的企业QQ在线咨询图标联系我们并购买后,我们为您免费进行无缝搬家服务,让您享受网站零访问延迟的迁移到道勤主机的服务!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

道勤网- 推荐内容!上一条 /2 下一条

!jz_fbzt! !jz_sgzt! !jz_xgzt! 快速回复 !jz_fhlb! !jz_lxwm! !jz_gfqqq!

关于我们|手机版|小黑屋|地图|【道勤网】-www.daoqin.net 软件视频自学教程|免费教程|自学电脑|3D教程|平面教程|影视动画教程|办公教程|机械设计教程|网站设计教程【道勤网】 ( 皖ICP备15000319号-1 )

GMT+8, 2024-5-9 11:18

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

快速回复 返回顶部 返回列表