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

下载本文档

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

文档简介

文件系统和磁盘管理1、为一个有空闲空间的磁盘新建一个分区,对该分区进行格式化,把该分区挂载到/mnt/music目录,要求每次机器启动都自动挂载;2、挂载一个文件系统为FAT32类型的U盘;3、在计算机上添加交换文件,其块大小为60000;4、对/root/ab文件设置权限,所有者为读取、写入和执行权限,同组用户为读取和写入权限,而其他用户没有任何权限;5、假设局域网中有一台nfs服务器,其IP为,共享目录为/tmp;本机 的IP为,要求把nfs服务器的/tmp目录挂载到本机的/mnt/nfs目录上。【需求】【实验步骤】1、为一个有空闲空间的磁盘新建一个分区,对该分区进行格式化,把该分区挂载到/mnt/music目录,要求每次机器启动都自动挂载;1 系统当前的分区表信息。rootlinux /# fdisk -lDisk /dev/hda: 80.0 GB, 80060424192 bytes255 heads, 63 sectors/track, 9733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/hda1 * 1 13 104391 83 Linux/dev/hda2 14 1288 10241437+ 83 Linux/dev/hda3 1289 1415 1020127+ 82 Linux swap/dev/hda4 1416 9733 66814335 5 Extended/dev/hda5 1416 1496 650601 8e Linux LVM/dev/hda6 1497 1517 168651 fd Linux raid autodetect/dev/hda7 1518 1538 168651 fd Linux raid autodetect/dev/hda8 1539 1557 152586 83 Linux/dev/hda9 1558 2321 6136798+ 83 Linux/dev/hda10 2322 2386 522081 82 Linux swap由上面的信息可知,系统的扩展分区/dev/hda4中还有空闲的空间(因为该磁盘共有9733个柱面,/dev/hda4的结束柱面为9733,而该扩展分区中的最后一个逻辑分区/dev/hda10的结束柱面为2386,所以柱面23879733都是空闲的),于是可以新建一个100M的分区。2用fdisk新建一个分区。rootlinux /# fdisk /dev/hdaThe number of cylinders for this disk is set to 9733.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)Command (m for help): nFirst cylinder (2387-9733, default 2387): 2387Using default value 2387Last cylinder or +size or +sizeM or +sizeK (2387-9733, default 9733): +100MCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table.The new table will be used at the next reboot.Syncing disks.rootlinux /# reboot最后的警告,要求系统重启,新的分区表才会生效。3再查看系统的分区表,可以看到多了1个分区/dev/hda11。rootlinux /# fdisk -lDisk /dev/hda: 80.0 GB, 80060424192 bytes255 heads, 63 sectors/track, 9733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/hda1 * 1 13 104391 83 Linux/dev/hda2 14 1288 10241437+ 83 Linux/dev/hda3 1289 1415 1020127+ 82 Linux swap/dev/hda4 1416 9733 66814335 5 Extended/dev/hda5 1416 1496 650601 8e Linux LVM/dev/hda6 1497 1517 168651 fd Linux raid autodetect/dev/hda7 1518 1538 168651 fd Linux raid autodetect/dev/hda8 1539 1557 152586 83 Linux/dev/hda9 1558 2321 6136798+ 83 Linux/dev/hda10 2322 2386 522081 82 Linux swap/dev/hda11 2387 2399 104391 83 Linux4格式化该分区。rootlinux /# mkfs.ext3 /dev/hda115把该分区挂载到/mnt/music目录。rootlinux /# mkdir /mnt/musicrootlinux /# mount /dev/hda11 /mnt/music6在/etc/fstab最后添加一项,使其每次开机都自动挂载。rootlinux /# vi /etc/fstab# This file is edited by fstab-sync - see man fstab-sync for detailsLABEL=/ / ext3 defaults 1 1LABEL=/boot /boot ext3 defaults 1 2none /dev/pts devpts gid=5,mode=620 0 0none /dev/shm tmpfs defaults 0 0none /proc proc defaults 0 0none /sys sysfs defaults 0 0/dev/hda3 swap swap defaults 0 0LABEL=SWAP-hda10 swap swap defaults 0 0/dev/hda11 /mnt/music ext3 defaults 0 02、挂载一个文件系统为FAT32类型的U盘;1插入U盘后,就可查看该U盘的设备名及分区表信息。rootlinux /# fdisk -lDisk /dev/hda: 80.0 GB, 80060424192 bytes255 heads, 63 sectors/track, 9733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/hda1 * 1 13 104391 83 Linux/dev/hda2 14 1288 10241437+ 83 Linux/dev/hda3 1289 1415 1020127+ 82 Linux swap/dev/hda4 1416 9733 66814335 5 Extended/dev/hda5 1416 1496 650601 8e Linux LVM/dev/hda6 1497 1517 168651 fd Linux raid autodetect/dev/hda7 1518 1538 168651 fd Linux raid autodetect/dev/hda8 1539 1557 152586 83 Linux/dev/hda9 1558 2321 6136798+ 83 Linux/dev/hda10 2322 2386 522081 82 Linux swap/dev/hda11 2387 2399 104391 83 LinuxDisk /dev/sda: 264 MB, 264110080 bytes16 heads, 32 sectors/track, 1007 cylindersUnits = cylinders of 512 * 512 = 262144 bytesDevice Boot Start End Blocks Id System/dev/sda1 * 1 1008 257904 b W95 FAT32Partition 1 has different physical/logical endings:phys=(1023, 15, 32) logical=(1007, 7, 32)上面的/dev/sda即是刚插入的U盘,它只有一个分区/dev/sda1,类型为FAT32。在Red Hat AS 4.0中,只要插入U盘,系统就会把它自动挂载到/media目录下,但是存在一个问题就是,如果U盘里的文件名为中文的话,就不能正常显示;如果想让它能够正常显示中文文件名,就需要手动挂载。2先卸载,然后手动挂载。rootlinux /# umount /dev/sda1rootlinux /# mkdir /media/u-diskrootlinux /# mount -o iocharset=gb2312 /dev/sda1 /media/u-diskrootlinux /# ls /media/u-disk/硕士学位论文0525.doc 答辩建议.txtexe20040607.doc 计算机系2004级毕业答辩通知版.xls 挂载时,设置了iocharset选项后即可正常显示中文文件名。4、对/root/ab文件设置权限,所有者为读取、写入和执行权限,同组用户为读取和写入权限,而其他用户没有任何权限;5、假设局域网中有一台nfs服务器,其IP为,共享目录为/tmp;本机 的IP为,要求把nfs服务器的/tmp目录挂载到本机的/mnt/nfs目录上。【需求】【实验步骤】1编辑/etc/auto.master,在末尾添加一行。rootlinux tmp# vi /etc/auto.master# $Id: auto.master,v 1.3 2003/09/29 08:22:35 raven Exp $# Sample auto.master file# This is an automounter map and it has the following format# key -mount-options-separated-by-comma location# For details of the format look at autofs(5).#/misc /etc/auto.misc -timeout=60#/misc /etc/auto.misc#/net /etc/ /mnt /etc/auto.misc -timeout=302编辑/etc/auto.misc,在末尾添加一行。rootlinux tmp# vi /etc/auto.misc# $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $# This is an automounter map and it has the following format# key -mount-options-separated-by-comma location# Details may be found in the autofs(5) manpagecd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom# the following entries are samples to pique your imagination#linux -ro,soft,intr :/pub/linux#boot -fstype=ext2 :/dev/hda1#floppy -fstype=auto :/dev/fd0#floppy -fstype=ext2 :/dev/fd0#e2floppy -fstype=ext2 :/dev/fd0#jaz -fstype=ext2 :/dev/sdc1#removable -fstype=ext2 :/dev/hddnfs -ro,soft,intr :/tmp3启动autofs服务。rootlinux webmin-1.150# service autofs start4测试是否能够自动挂载和卸载。rootlinux tmp# ls /mnt -a. .

温馨提示

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

评论

0/150

提交评论