




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
linux fdisk 分区、格式化、挂载!fdisk 分区 格式化 自动挂载! ext3格式化, ext4格式化 及挂载关于硬盘分区:主分区(包含扩展分区)、逻辑分区,主分区最多有4个(包含扩展分区)。因此我们在对硬盘分区时最好划分主分区连续,比如说:主分区一、主分区二、扩展分区。此文章以fdisk工具为例,对一个硬盘划分。1、fdisk-l查看系统上的硬盘,找到需要分区的硬盘后比如说:/dev/sdb.然后,fdisk/dev/sdb进入该设备。此时出现:Command(mforhelp):查看帮助信息:输入m,看到如下信息Commandactionatoggleabootableflagbeditbsddisklabelctogglethedoscompatibilityflagddeleteapartition注:这是删除一个分区的动作;llistknownpartitiontypes注:l是列出分区类型,以供我们设置相应分区的类型;mprintthismenu注:m是列出帮助信息;naddanewpartition注:添加一个分区;ocreateanewemptyDOSpartitiontablepprintthepartitiontable注:p列出分区表;qquitwithoutsavingchanges注:不保存退出;screateanewemptySundisklabeltchangeapartitionssystemid注:t改变分区类型;uchangedisplay/entryunitsvverifythepartitiontablewwritetabletodiskandexit注:把分区表写入硬盘并退出;xextrafunctionality(expertsonly)注:扩展应用,专家功能;具体每个参数的含义,请仔细阅读。常用的就是:dlmpqtw2、列出当前操作硬盘的分区情况,用pCommand(mforhelp):pDisk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+cW95FAT32(LBA)/dev/sda2261258064005Extended/dev/sda52650201568+83Linux/dev/sda6517620078183Linux3、通过fdisk的d指令来删除一个分区Command(mforhelp):p注:列出分区情况;Disk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+cW95FAT32(LBA)/dev/sda2261258064005Extended/dev/sda52650201568+83Linux/dev/sda6517620078183LinuxCommand(mforhelp):d注:执行删除分区指定;Partitionnumber(1-6):6注:我想删除sda6,就在这里输入6;Command(mforhelp):p注:再查看一下硬盘分区情况,看是否删除了?Disk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+cW95FAT32(LBA)/dev/sda2261258064005Extended/dev/sda52650201568+83LinuxCommand(mforhelp):警告:删除分区时要小心,请看好分区的序号,如果您删除了扩展分区,扩展分区之下的逻辑分区都会删除;所以操作时一定要小心;如果知道自己操作错了,请不要惊慌,用q不保存退出;切记切记!在分区操作错了之时,千万不要输入w保存退出!4、通过fdisk的n指令增加一个分区Command(mforhelp):pDisk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+cW95FAT32(LBA)/dev/sda2261258064005Extended/dev/sda52650201568+83LinuxCommand(mforhelp):n注:增加一个分区;Commandactionllogical(5orover)注:增加逻辑分区,分区编号要大于5;为什么要大于5,因为已经有sda5了;pprimarypartition(1-4)注:增加一个主分区;编号从1-4;但sda1和sda2都被占用,所以只能从3开始;pPartitionnumber(1-4):3Nofreesectorsavailable注:失败中,为什么失败?注:我试图增加一个主分区,看来是失败了,为什么失败?因为我们看到主分区+扩展分区把整个磁盘都用光了,看扩展分区的End的值,再看一下p输出信息中有125cylinders;最好还是看前面部份;那里有提到;所以我们只能增加逻辑分区了;Command(mforhelp):nCommandactionllogical(5orover)pprimarypartition(1-4)l注:在这里输入l,就进入划分逻辑分区阶段了;Firstcylinder(51-125,default51):注:这个就是分区的Start值;这里最好直接按回车,如果您输入了一个非默认的数字,会造成空间浪费;Usingdefaultvalue51Lastcylinderor+sizeor+sizeMor+sizeK(51-125,default125):+200M注:这个是定义分区大小的,+200M就是大小为200M;当然您也可以根据p提示的单位cylinder的大小来算,然后来指定End的数值。回头看看是怎么算的;还是用+200M这个办法来添加,这样能直观一点。如果您想添加一个10G左右大小的分区,请输入+10000M;Command(mforhelp):5、通过fdisk的t指令指定分区类型Command(mforhelp):t注:通过t来指定分区类型;Partitionnumber(1-6):6注:要改变哪个分区类型呢?我指定了6,其实也就是sda6Hexcode(typeLtolistcodes):L注:在这里输入L,就可以查看分区类型的id了;Hexcode(typeLtolistcodes):b注:如果我想让这个分区是W95FAT32类型的,通过L查看得知b是表示的是,所以输入了b;Changedsystemtypeofpartition6tob(W95FAT32)注:系统信息,改变成功;是否是改变了,请用p查看;Command(mforhelp):pDisk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+cW95FAT32(LBA)/dev/sda2261258064005Extended/dev/sda52650201568+83Linux/dev/sda65175201568+bW95FAT326、fdisk的退出,用q或者w其中q是不保存退出,w是保存退出7、一个添加分区的例子本例中我们会添加两个200M的主分区,其它为扩展分区,在扩展分区中我们添加两个200M大小的逻辑分区;Command(mforhelp):p注:列出分区表;Disk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystemCommand(mforhelp):n注:添加分区;Commandactioneextendedpprimarypartition(1-4)p注:添加主分区;Partitionnumber(1-4):1注:添加主分区1;Firstcylinder(1-125,default1):注:直接回车,主分区1的起始位置;默认为1,默认就好;Usingdefaultvalue1Lastcylinderor+sizeor+sizeMor+sizeK(1-125,default125):+200M注:指定分区大小,用+200M来指定大小为200MCommand(mforhelp):n注:添加新分区;Commandactioneextendedpprimarypartition(1-4)p注:添加主分区Partitionnumber(1-4):2注:添加主分区2;Firstcylinder(26-125,default26):Usingdefaultvalue26Lastcylinderor+sizeor+sizeMor+sizeK(26-125,default125):+200M注:指定分区大小,用+200M来指定大小为200MCommand(mforhelp):nCommandactioneextendedpprimarypartition(1-4)e注:添加扩展分区;Partitionnumber(1-4):3注:指定为3,因为主分区已经分了两个了,这个也算主分区,从3开始;Firstcylinder(51-125,default51):注:直接回车;Usingdefaultvalue51Lastcylinderor+sizeor+sizeMor+sizeK(51-125,default125):注:直接回车,把其余的所有空间都给扩展分区;Usingdefaultvalue125Command(mforhelp):pDisk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+83Linux/dev/sda2265020160083Linux/dev/sda3511256048005ExtendedCommand(mforhelp):nCommandactionllogical(5orover)pprimarypartition(1-4)l注:添加逻辑分区;Firstcylinder(51-125,default51):Usingdefaultvalue51Lastcylinderor+sizeor+sizeMor+sizeK(51-125,default125):+200M注:添加一个大小为200M大小的分区;Command(mforhelp):nCommandactionllogical(5orover)pprimarypartition(1-4)l注:添加一个逻辑分区;Firstcylinder(76-125,default76):Usingdefaultvalue76Lastcylinderor+sizeor+sizeMor+sizeK(76-125,default125):+200M注:添加一个大小为200M大小的分区;Command(mforhelp):p列出分区表;Disk/dev/sda:1035MB,1035730944bytes256heads,63sectors/track,125cylindersUnits=cylindersof16128*512=8257536bytesDeviceBootStartEndBlocksIdSystem/dev/sda1125201568+83Linux/dev/sda2265020160083Linux/dev/sda3511256048005Extended/dev/sda55175201568+83Linux/dev/sda676100201568+83Linux然后我们根据前面所说通过t指令来改变分区类型;最后不要忘记w保存退出;如果是系统所在盘会提示重启,重启就OK了。接下来进行第5步五、对分区进行格式化,以及加载;先提示一下;用mkfs.bfsmkfs.ext2mkfs.jfsmkfs.msdosmkfs.vfatmkfs.cramfsmkfs.ext3mkfs.minixmkfs.reiserfsmkfs.xfs等命令来格式化分区,比如我想格式化sda6为ext3文件系统,则输入;rootlocalhostbeinan#mkfs-text3-c/dev/sda6具体参数含义,请manmkfs。如果我想加载sda6到目前系统来存取文件,应该有mount命令,但首先您得建一个挂载目录;比如/mnt/sda6;rootlocalhostbeinan#mkdir/mnt/sda6rootlocalhostbeinan#mount/dev/sda6/mnt/sda6rootlocalhostbeinan#df-lhFilesystem容量已用可用已用%挂载点/dev/hda811G8.4G2.0G81%/dev/shm236M0236M0%/dev/shm/dev/hda1016G6.9G8.3G46%/mnt/hda10/dev/sda6191M5.6M176M4%/mnt/sda68,自动挂载分区当在系统里创建了一个新的分区后,因为mount挂载在重启服务后会失效,所以需要将分区信息写到/etc/fstab文件中让其永久挂载,编辑/etc/fstab里加入:输入红色内容/dev/sdb1(磁盘分区)/home(mount目录)ext3(文件格式)defaults00步骤/方法1. rootlibftp # fdisk -l (这个命令是查看你为挂载的分区的位置)WARNING: GPT (GUID Partition Table) detected on /dev/cciss/c0d1! The util fdisk doesnt support GPT. Use GNU Parted.Disk /dev/cciss/c0d1: 4000.6 GB, 4000684662784 bytes255 heads, 63 sectors/track, 486388 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/cciss/c0d1p1 1 267350 2147483647+ ee EFI GPT2. 使用parted命令:rootlibftp # parted /dev/cciss/c0d1 (这个命令是对我们上面查到的分区进行GPT转换)GNU Parted 1.8.1Using /dev/cciss/c0d1Welcome to GNU Parted! Type help to view a list of commands.(parted) mklabel gptWarning: The existing disk label on /dev/cciss/c0d1 will be destroyed and all data on this disk will be lost. Do you want tocontinue?Yes/No? yNew disk label type? gpt? gpt3. (parted) mkpart primary 0 4000GB(进行转换及分区)(parted) printModel: Compaq Smart Array (cpqarray)Disk /dev/cciss/c0d1: 4001GBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 17.4kB 4001GB 4001GB primary(parted) quitInformation: Dont forget to update /etc/fstab, if necessary.4. rootlibftp # mkfs.ext3 -F /dev/cciss/c0d1(格式化为EXT3文件系统)mke2fs 1.39 (29-May-2006)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)488374272 inodes, 976729654 blocks48836482 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=029808 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,102400000, 214990848, 512000000, 550731776, 644972544Writing inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 22 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.5. 挂载(因为这样挂在比较麻烦 我们用下面的命令进行开机挂在)rootlibftp # mkdir -p /mnt/cciss/c0d1rootlibftp # mount /dev/cciss/c0d1 /mnt/cciss/c0d1rootlibftp # df -hFilesystem Size Used Avail Use% Mounted on/dev/cciss/c0d0p5 15G 1.8G 12G 13% /dev/cciss/c0d0p3 19G 173M 18G 1% /usr/local/dev/cciss/c0d0p2 862G 200M 817G 1% /else/dev/cciss/c0d0p1 251M 21M 218M 9% /boottmpfs 2.0G 0 2.0G 0% /dev/shm/dev/cciss/c0d1 3.6T 197M 3.4T 1% /mnt/cciss/c0d16. 开机自动挂载这块硬盘:vi /etc/rc.local加上:mount /dev/cciss/c0d1 /mnt/cciss/c0d17. 注:次文章不能算是完整的原创,本人的修改只是为了让非高手看的更白一些Version 3 Version 4 Version 5 Version 6 Maximum logical CPUs 2 x86 16 32 32 32 Itanium2 8 256/512 256/1024 N/A 6 X86_64 8 64/64 64/255 128/4096 POWER 8 64/128 128/128 128 System z 32 (z900) 64 (z10 EC) 64 (z10 EC) 80 (z196) Maximum memory X86 64GB 3 64GB 3 16GB 4 16GB 4 Itanium2 128GB 2TB 2TB N/A 6 X86_64 128GB 2TB 2TB 2TB/64TB 5 POWER 64GB 128GB/1TB 512GB/1TB 2TB System z 256GB (z900) 1.5TB (z10 EC) 1.5TB (z10 EC) 3TB (z196) Required minimums X86 256MB 256MB 512MB minimum/1 GB/logical CPU recommended 512MB minimum/1 GB/logical CPU recommended X86_64 256MB 256MB 512MB/1 GB/logical CPU recommended 1GB minimum/1 GB/logical CPU recommended Itanium2 512MB 512MB 512MB/1 GB/logical CPU recommended N/A 6 POWER 512MB 512MB 1GB minimum/2GB recommended 2GB minimum/2GB required per install Minimum diskspace 800MB 800MB 1GB minimum/5GB recommended 1GB minimum/5GB recommended Filesystems and Storage Limits Maximum filesize (Ext3) 2TB 2TB 2TB 2TB Maximum filesystem size (Ext3) 2TB 8TB 16TB 16TB Maximum filesize (Ext4) - - - 16TB Maximum filesystem size (Ext4) - - - 16TB Maximum filesize (GFS) 2TB 16TB/8EB 16TB/8EB 7 N/A Maximum filesystem size (GFS) 2TB 16TB/8EB 16TB/8EB 7 N/A Maximum filesize (GFS2) - - 25TB 100TB Maximum filesystem size (GFS2) - - 25TB 100TB Maximum filesize (XFS) - - 100TB 100TB Maximum filesystem size (XFS) - - 100TB 100TB Maximum Boot LUN size (BIOS) - - 2TB 2TB 10 Maximum Boot LUN size (UEFI) - - NA Any 10 Maximum x86 per-process virtual address space Approx 4GB Approx 4GB Approx 3GB 4 Approx 3GB 4 Maximum x86_64 per-process virtual address space 512GB 2TB 128TB Virtualization Limits Maximum number of virtual CPUS in Guest (x86) - - 32 8 32 Maximum memory in paravirtualized guest (x86) - - 16GB - Maximum memory in fully virtualized x86 guest on x86 host - - 7.9GB - Maximum memory in fully virtualized x86 guest on x86_64 host - - 16GB 16GB Maximum number of virtual CPUS in Guest (x86_64) on x86_64 host - - 32 8 64 12 Maximum memory in paravirtualized guest (x86_64) on x86_64 host - - 80GB/unlimited - Maximum memory in fully virtualized guest (x86_64) on x86_64 host - - 80GB/unlimited 256GB 9 Kernel and OS features Kernel foundation Linux 2.4.21 Linux 2.6.9 Linux 2.6.18 2.6.32 - 2.6.34 Compiler/toolchain GCC 3.2 GCC 3.4 GCC 4.1 GCC 4.4 Languages supported 10 15 19 22 NIAP/CC certified 11 Yes (3+) Yes (4+) Yes (4+) Under Evaluation Common Criteria certified KVM 11 - - Under Evaluation Under Evaluation IPv6 - - Ready Logo Phase-II Under Evaluation Compatibility libraries V2.1 V2.1 and V3 V3 and V4 V4 and V5 FIPS certified 11 - - Yes Under Evaluation Common Operating Environment (COE) compliant Yes Yes N/A N/A LSB compliant Yes - 1.3 Yes - 3 Yes - 3.1 Under Evaluation GB18030 No Yes Yes Yes Client environment Desktop GUI Gnome 2.2 Gnome 2.8 Gnome 2.16 Gnome 2.28 Graphics XFree86 X.org X.org 7.1.1 X.org 7.4 OpenOffice V1.1 V1.1.2 V2.0.4 12 V3.2 12 Gnome Evolution V1.4 V2.0 V2.8.0 V2.28 Default browser Mozilla Firefox Firefox 1.5 12 Firefox 3.6 12 Notes: 1 Supported limits reflect the current state of system testing by Red Hat and its partners for mainstream hardware. Systems exceeding these supported limits may be included in the Hardware Catalog after joint testing between Red Hat and its partners. If they exceed the supported limits posted here, entries in the Hardware Catalog will include a reference to the details of the system specific limits, and are fully supported. In addition to supported limits reflecting hardware capability, there may be additional limits under the Red Hat Enterprise Linux subscription terms. Supported limits are subject to change as on-going testing completes. 2 Red Hat defines a logical CPU as any schedulable entity. So every core/thread in a multi-core/thread processor is a logical CPU 3 The SMP kernel supports a maximum of 16GB of main memory. Systems with more than 16GB of main memory use the Hugemem kernel. In certain workload scenarios it may be advantageous to use the Hugemem kernel on systems with more than 12GB of main memory. 4 The x86
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年区块链技术在物流行业应用前景与挑战分析报告
- 2025年智能制造技术在工业0时代的应用前景研究报告
- 商场保安安全培训计划课件
- 国家事业单位招聘2025自然资源实物地质资料中心招聘拟聘用人员笔试历年参考题库附带答案详解
- 四川省2025年四川资阳市雁江区引进急需紧缺专业人才笔试历年参考题库附带答案详解
- 北京市2025北京邮电大学人工智能学院招聘2人(人才派遣)笔试历年参考题库附带答案详解
- 2025福建厦门海沧湾投资开发有限公司招聘笔试参考题库附带答案详解
- 2025甘肃人力委托招聘风电叶片主修岗位10人笔试参考题库附带答案详解
- 2025广西北海市小微企业融资担保有限公司招聘实习生6人笔试参考题库附带答案详解
- 2025年贵州乌江水电开发有限责任公司大学毕业生招聘若干人笔试参考题库附带答案详解
- 人教版(新教材)高中生物选择性必修1课件3:4 3 免疫失调
- 《SLT 582-2025水工金属结构制造安装质量检验检测规程》知识培训
- “燕园元培杯”2023-2024学年全国中学生地球科学奥林匹克竞赛决赛试题详解
- 中国血脂管理指南(基层版+2024年)解读
- 分子诊断技术在感染性疾病中的应用-深度研究
- 《智能AI分析深度解读报告》课件
- 气道异物护理教学
- 2024年版机电产品国际招标标准招标文件
- 企业合规经营规范手册
- 企业员工心理健康与欺凌防范政策
- 四川省兴文县建设煤矿2021年矿山储量年报
评论
0/150
提交评论