磁盘管理和文件系统管理.docx_第1页
磁盘管理和文件系统管理.docx_第2页
磁盘管理和文件系统管理.docx_第3页
磁盘管理和文件系统管理.docx_第4页
磁盘管理和文件系统管理.docx_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

磁盘管理和文件系统管理-段承龙5月4日目录磁盘管理和文件系统管理1第一部分2一、磁盘结构2二、磁盘的命名规则4三、列出设备6四、识别设备6五、执行磁盘分区7六、管理磁盘标签7第二部分8一、文件系统8二、检查文件系统(sa239 157页)11三、挂载和卸载文件系统11四、监控文件系统(sa239 165页)13第三部分 总结14第一部分一、 磁盘结构1. 扇区2. 磁道3. 柱面4. 片逻辑上划分为slices,以柱面为基础。a disk under the solaris oe can be divided into eight slices that are labeled slice 0 through slice 7.(划分到0-7,一共8个slices)下图是柱面和slices的关系图:5. 默认的片划分规则二、 磁盘的命名规则/dev/rdsk/cwtxdysz 例子: /dev/dsk/c0t3d0s0 cn:controller number 控制器号,标识被硬盘控制的加到系统上的逻辑顺序. c0代表第一个硬盘控制器,c1代表第二个硬盘控制器,类推. tn:target number 目标号,是位于控制器内的地址,通常在外围设备的背面能找到目标号. 对scsi硬盘,tx又称为“scsi标识符“,控制器(cx)通过这个磁盘号对每个磁盘/硬盘独立寻址 对磁盘阵列中,一组磁盘被模拟成单独的磁盘(一组磁盘看成一个磁盘),也用tx标识 对ide磁盘而言,tx只有0,1两个地址,master盘的tx是0,slave盘的tx是1dn:disk number 硬盘号,代表连在目标上的设备的逻辑单位号.d0代表第一 个硬盘,d1代表第二个硬盘,依次类推.对嵌入式scsi控制器, 硬盘驱动号总是0. sn:slice or portition numer 片或分区号,标识硬盘的分区.设备名主要看cxtx两个数 t 是target number,对于scsi设备,就是对应的scsi地址。一般scsi硬盘都靠t来区分(因为c控制器,d lun, 经常是相同的,而s slice对硬盘来说都是0)c0t0d0s0 第1硬盘c0t1d0s0 第2个硬盘c0t6d0s0 是内部光驱(scsi光驱的scsi地址经常6)ultra 5/10 的ata硬盘(ide接口)完全违背了上边的定义ultra5/10是ide 接口,其设备号是光驱:第二通道 master c0t2d0硬盘:第二通道 slave c0t3d0违背了:应该:通道1是 c0,通道2是c2但ultra 的第2通道并不是c1,还是c0 应该:t代表scsi接口硬盘,对ide硬盘只有t0(master),t1(slave)但ultra 用t2,t3标识第二通道的ide硬盘 总之,utra 把ide硬盘模拟成scsi硬盘关系图(分两种)三、 列出设备三种方法列出设备using the /etc/path_to_inst le using the prtconf command using the format command/etc/pasth_to_inst注意:the /etc/path_to_inst le is maintained by the kernel, and it is generally not necessary, nor is it advisable, for the system administrator to change this le.prtconf使用prtconf | grep -v not 查看formatuse the format command to display both logical and physical device names for all currently available disks. to view the logical and physical devices for currently available disks,perform the command:# formatsearching for disks.doneavailable disk selections:0. c0t0d0 /pci1f,0/pci1,1/idee/dad0,01. c1t0d0 /pciif,0/pci1/sunw,isptwo4/sd3,0specify disk (enter its number):四、 识别设备使用 devfsadmthe devfsadm command performs the device reconguration process and updates the /etc/path_to_inst le and the /dev and /devices directories during reconguration events.(实质上就是更新两个文件,而不需要重启系统。另外还有一种需要重启系统的方法就不做介绍了,基本上用不上,也没什么优点。)devfsadm的用法指定 设备类型 devfsadm -c device_class# devfsadm -c disk -c tape -c audio指定 设备驱动名 devfsadm -i driver_name# devfsadm -i dad/sa/st等等显示devfsadm命令的执行 # devfsadm -v清除/dev下无效的链接 # devfsadm -c五、 执行磁盘分区首先要理解下图:(最后一步label,必不可少)使用format命令进行分区第一步使用命令devfsadm 识别出新的磁盘设备第二步使用formt命令查看新添加的物理磁盘第三步选择列出磁盘的序号,进入,使用fdisk命令创建默认分区第四步partition命令列出默认分区,再使用命令print列出所有分区的信息第五步选择0-7之间的(除了2,代表全分区),按照提示创建分区大小第六步退出partition,在format提示符下,使用命令label命令(这步很重要,否则前面设置的不生效)六、 管理磁盘标签1. 在format工具下,verify命令查看label状态。2. 关于vtoc使用prtvtoc命令查看label,举例:prtvtoc /dev/rdsk/c0t1d0s0应用:vtoc文件可以保存,然后重新导入。导入之后就是使用新的分区表,立即生效。具体的操作方法:保存:prtvtoc /dev/rdsk/c1t0d0s2 /vtoc/c1t0d0 导入:fmthard -s /vtoc/c1t0d0 /dev/rdsk/c1t0d0s2第二部分一、 文件系统1、 文件系统类型文件系统描述ufsthe unix le system in the solaris oe is based on the berkeley fast le systemhsfsthe high sierra le system is a special-purpose le system developed for use on cd-rom media.pcfsthe pc le system is a unix implementation of the disk operating system (dos) le allocation table (fat32) le system. the pcfs le system allows the solaris oe to access pc-dos formatted le systems. users can use unix commands for direct read and write access to pc-dos les.udfsthe universal disk format le system is used for optical storage targeted at dvd and cd-rom media. the udf le system allows universal data exchange and supports read and write operations.nfsthe network le system allows users to share les among many types of systems on the network. the nfs le system makes part of a le system on one system appear as though it were part of the local directory tree.tmpfsthe temporary le system stores les in memory, which avoids the overhead of writing to a disk-based le system. the tmpfs le system is created and destroyed every time the system is rebooted.swapfsthe swap le system is used by the kernel to manage swap space on disks.fdfsfdfs the le descriptor le system provides explicit names for opening les by using le descriptors (for example, /dev/fd/0, /dev/fd/1, /dev/fd/2)inthe /dev/fd cfsthe process le system contains a list of active processes in the /proc directory. the processes are listed by process number. information in this directory is used by commands, such as the ps command.mntfsthe mount le system provides read-only information from the kernel about locally mounted le systems2、 ufs文件系统结构(sa239 148页)disk label(vtoc)磁盘的分区表,属于磁盘的第一个扇区 (512字节)。仅有磁盘的第一次slice包含vtoc,文件系统创建时会默认跳过这个区域。bootblock(引导块)1-15扇区属于引导块,紧跟着vtoc,而且仅有根文件系统有激活的引导块。然而其他文件系统没有引导块,但是这些区域依然会被分配空间。以上这两个区域不适于文件系统,以下属于文件系统primary superblock(主超级块)16-31扇区,在引导块之后。包含以下信息: the number of data blocks the number of cylinder groups the size of a data block and fragment a description of the hardware, derived from the label the name of the mount point file system state ag: clean, stable, active, logging, or unknownbackup superblocks(备用超级快)32扇区开始,原文解释如下:when the le system is created, each cylinder group replicates thesuperblock beginning at sector 32. this replication protects the critical data in the superblock against catastrophic loss.cylinder groupseach le system is divided into cylinder groups with a minimum default size of 16 cylinders per group. cylinder groups improve disk access.cylinder group blocksthe cylinder group block is a table in each cylinder group that describes the cylinder group, including: the number of inodes the number of data blocks in the cylinder group the number of directories free blocks, free inodes, and free fragments in the cylinder group the free block map the used inode map3、 inode的概念an inode contains the following information about a le: the type of le and the access modes the user identication (uid) and group identication (gid)numbers of the les owner and group the size of the le the link count the time the le was last accessed and modied and the inode changed the total number of data blocks used by or allocated to the le two types of pointers: direct pointers and indirect pointers4、 创建文件系统(sa239 154页)关于newfs命令说明使用权限必须是root,the newfs command is an easy-to-use front-end to the mkfs command,which you use to create le systems. the newfs command is located in the /usr/sbin directory.使用在裸设备上。注:慎用newfs,会破坏以前磁盘中存在的数据,所以新建文件系统以前,一定要确定是新的磁盘或者确认可以重建文件系统的磁盘。以免数据的丢失。命令:# newfs /dev/rdsk/c1t3d0s0(注意是裸设备,rdsk,挂载时是块设备dsk)建完文件系统后的问题the newfs command reserves between 1 and 10 percent of the le systemspace for maintenance of the le system. this free space, referred to asminfree, species the amount of space on the slice that is reserved orheld back from regular users. you can use the newfs -m %freecommand to preset the percentage of free space when you create a newle system.使用命令fstyp -v /dev/rdsk/c0t0d0s0 | head -10 查看。改变mini free%值的大小,# tunefs -m 1 /dev/rdsk/c1t3d0s0二、 检查文件系统(sa239 157页)主要是fsck命令的使用。当文件系统因为各种不当的操作损坏时,尝试使用fsck命令修复。使用的限制: 使用时应卸载文件系统 the / (root), /usr, and /var le systems should have the fsck command run on them while in single-user mode. when the state ag is“clean,” “stable,” or “logging,” le system scans are not run. lost+found 这个文件是fsck命令执行的必需的条件。如果没有空间,而且这个目录不存在。则执行fsck时,会失败。fsck命令的用法: # fsck /dev/rdsk/c0t0d0s7 to check a single unmounted le system, perform the command # fsck /export/home to check a le system using the mount point directory name as listed in the /etc/vfstab le, perform the command # fsck -o f,p /dev/rdsk/c0t0d0s5 the f option of the fsck command forces a le system check, regardle of the state of the le systems superblock state ag.the p option checks and xes the le system noninteractively (preen). theprogram exits immediately if a problem requiring intervention is found.三、 挂载和卸载文件系统1、 查看mount的文件系统mount 或者df查看2、 /etc/vsftab文件项目描述device to mountthe device to bemounted. for example, a local ufsle system /dev/dsk/c#t#d#s#, or a pseudo lesystem /proc.device to fsckthe raw or character device checked by the lesystem check program (fsck) if applicable. apseudo le system has a dash (-) in this eld.mount pointthe name of the directory that serves as the attachmount point in the solaris oe directory hierarchy.fs typethe type of le system to be mounted.fsck passindicates whether the le system is to be checkedby the fsck utility at boot time. a 0 (zero) or anonnumeric in this eld indicates no. a 1 in thiseld indicates the fsck utility gets started for thatentry and runs to completion. a number greaterthan 1 indicates that the device is added to the listof devices to have the fsck utility run. the fsckutility can run on up to eight devices in parallel.this eld is ignored by the mountall command.mount at bootenter yes to enable the mountall command tomount the le systems at boot time. enter no toprevent a le system mount at boot time.这个文件是可编辑的,但是要注意固定格式,使用tab键分隔开机自动挂载 将 mount at boot 改为 yes3、 /etc/mnttab这个文件也是可编辑的,但是要注意固定格式,使用tab键分隔项目描述mount pointthe mount point or directory name where the lesystem is to be attached within the / (root) le system(for example, /usr, /opt).device namethe name of the device that is mounted at the mountpoint. this block device is where the le system isphysically located.mount options the list of mount options in effect for the le systemdate and timem

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论