导读
所有有系统都一样,都是一种软件被安装于某个硬件之上,这个硬件无外非是一种储存设备,一般操作系统都是安装在c盘中linux 删除磁盘设备,所以Linux系统也是一样,都是安装在c盘中,并且它与Windows系统不一样,由于Linux都是须要创建文件系统才可以使用。
1、磁盘分类
目前市场上的c盘分类有:IDEc盘(多用于PC机)、SATAc盘、SASc盘、SSDc盘等如此几种分类,企业中服务器大多为前面的两种,SATAc盘多用于企业内部的一些业务、SASc盘多用于对外的业务(一些业务平台)。
SATAc盘目前容量最大为4T、SASc盘通常都在300G–600G居多,企业生产环境中使用也最多的是这些容量的,实际生产中c盘的使用主要是看性能需求,也就是c盘的读写速率。
2、磁盘的体系结构
企业级服务器多块c盘的情况
3、磁盘容量的估算
c盘的结构通常包括扇区、盘面、扇区、碰头等
一个扇区的大小=512字节*磁道数
一个大盘的大小=扇区的大小*扇区数
一个c盘的大小=大盘大小*盘片数
因而linux软件下载,一个c盘的容量=512字节*磁道数*扇区数*盘片数
4、磁盘分区
所有c盘的分区信息都是储存在分区表中,Linux系统仅支持4个分区表信息(主分区+扩充分区),一个分区表的大小在64bytes
Linux通常分为三个分区分别是:boot分区、swap分区、/根分区
Linux的分区编号:主分区1-4,逻辑分区从5开始估算
实际生产环境分区要求
1、最少要有/和swap两个分区
2、swap(虚拟显存)=1.5*化学显存大小,通常大小于或等于16G的化学显存的服务器linux 删除磁盘设备,swap分区通常都直接设置为16G大小
3、建议设置/boot分区,Linux引导分区,如内核文件等,通常所有文件一共才几十M的大小linux是什么,因而这个分区就设置为100-200M即可
5、磁盘分区工具fdisk
fdisk是针对c盘容量大于2T
[root@cairui ~]# fdisk --help fdisk: invalid option -- '-' fdisk: Usage: fdisk [options] change partition table fdisk [options] -l list partition table(s) fdisk -s give partition size(s) in blocks Options: -b sector size (512, 1024, 2048 or 4096) -c switch off DOS-compatible mode -h print help -u give sizes in sectors instead of cylinders -v print version -C specify the number of cylinders -H specify the number of heads -S specify the number of sectors per track : Success
[root@localhost ~]# fdisk /dev/sda1 #对/dev/sda1进行分区操作 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x02fadd9c. 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 action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-2610, default 1): 设置起始柱面 Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 设置大小或柱面 Using default value 2610 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): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. Command (m for help): p 打印分区表信息 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 121 / 753 I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xb712cc55 Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux 分区完成后执行 partprobe 通知系统分区表发生改变 接下来进行格式化分区 [root@Centos ~]# mkfs.ext3 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe cyl|min|opt] alignment for new partitions COMMANDs: align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system move NUMBER START END move partition NUMBER name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted