Linux,文件系统概念

https://www.linux.org/threads/linux-file-systems.4123/

这是一个初学者的课程,Linux的新手所发现的概念之一就是Linux中文件系统的概念。也就是说,在Linux中存储和管理数据的方式。大多数用户都熟悉文件。用最简单的话来说,可以说文件只是存储在磁盘上的数据项的集合。但是,这些文件存储在磁盘上的方式可能因多种因素而异。速度,安全性,数据冗余等... 

Linux支持许多不同类型的文件系统格式。这里只是一些... 

Ext2:这就像UNIX文件系统。它有块,inode和目录的概念。

Ext3:除了添加日志功能之外,它与ext2文件系统向后兼容。日志允许快速的文件系统恢复。包括对访问控制列表(ACL)的支持。

Isofs:由CDROM文件系统(iso9660)使用。

Procfs:proc文件系统充当内核中内部数据结构的接口。它可以用来获取关于系统的信息,并使用sysctl命令在运行时更改某些内核参数。

挂载文件系统
在这部分关于文件系统的课程中,我们将学习如何使用mount和umount命令

我们之前曾经提到过,在Linux中,软盘驱动器,CD-ROM驱动器以及硬盘的另一个分区(例如Windows分区)有一个不同的概念。尽管Linux的一些窗口管理器有一些用于点击图标来访问软盘驱动器的规定,但是这背后的方法与其他操作系统完全不同。在Linux中,软盘驱动器或其他设备必须“安装”。这意味着基本上,将其临时并入您的Linux文件系统,换句话说,告诉Linux,它是一个文件被写入或复制。

您可以使用mount命令来复制到其他设备。

如果您想从CD-ROM获取一些文件,则执行此操作的标准命令是:

码:
mount -t iso9660 / dev / hdb / cdrom
类型iso9660是CD的标准文件系统。设备(/ dev / hdb)是非SCSI类型的CD-ROM,挂载点(/ cdrom)应该存在。如果没有的话,你应该使用'mkdir'在根目录下创建它,就像你在/ floppy目录下做的一样。

请记住CD-ROM的概念是只读的。您将无法写入这种类型的CD-ROM驱动器。一条消息会告诉你,当你装这种类型的设备。

安装硬盘的另一个分区。

许多人可能更喜欢与其他操作系统一起安装Linux。您可能将Linux和Windows安装在同一台计算机上。如果你想访问Windows分区上的文件,你可以输入以下命令:
码:
mount -t vfat / dev / hda1 / mnt
Windows始终处于主分区,所以我们使用了device / hda1(硬盘分区1)。在这种情况下,/ mnt的选择是标准挂载点。您也可以使用/ mnt目录安装其他设备(软盘,CD)。我使用不同的空目录(/ floppy / cdrom / mnt)来避免混淆。

如果您更改为安装目录(cd / mnt),然后输入:ls,您将看到一些有趣的内容。目录是蓝色的,但文件是绿色的(或红色 - 取决于你的Linux发行版)。您将不会像在Linux中那样拥有各种颜色组合。这是因为Windows的文件系统不能区分文件类型。一切看起来像是一个程序(二进制),而不是一个普通的文件。

当你将文件从Windows分区复制到Linux分区时,你应该记住这一点。例如,如果您想将Windows分区中的mp3文件复制到Linux分区来测试您的声音配置,它将显示为可执行程序,而不仅仅是Linux下的标准文件。这不会影响您的播放效果,但是为了更准确地记录系统上的内容,您可能需要更改文件的权限,以便在配色方案中显示为常规文件。我们将讨论文件许可权,并尽快对其进行更改。



卸载

挂载不属于标准Linux系统的文件系统在Linux中被认为是临时的条件。现在我们知道如何在Linux中安装这些外部文件系统,现在最重要的事情就是在完成使用之后学习如何卸载它。

在Linux早期,如果您在完成后没有手动卸载,则可能会严重损坏系统。如今,如果你已经安装了一个系统,并且在不卸载的情况下关闭了计算机,那么你很可能会抛弃一个文件系统。但是,Slim对我来说还不够好。我宁可不要冒险 当我完成这些工作时,我总是花时间卸载这些外部文件系统。

这个命令是:
码:
umount [/ mount点]
在本课中使用的例子中,挂载点是:
码:
软盘:/软盘 - 因此卸载/软盘
CD:/ cdrom  -  umount / cdrom
Windows分区 -  umount / mnt
还记得不要访问磁盘。当你使用umount或者它会给你一个驱动busymessage。如果你得到这个,你可能已经把一个终端打开了,在你正在使用的地方复制或写入特定的驱动器。检查你的终端,如果你得到这个错误。

我只是想指出另一件事。你正在“卸载”,但命令是卸载的(也就是说,没有卸载)在我开始使用Linux时,你已经熟悉mount这个概念,所以我输入unmount而不是unmount,这让我大吃一惊。 : 找不到命令。呃,呃,我做错了事。我花了一段时间才弄清楚这个命令没有包括一个N.我还没有真正做过一个调查,究竟有多少人实际上做了这个。就我所知,我可能是唯一拥有,

那么,现在你可以使用大多数PC用户需要的标准设备。后来在高级课上,我们将讨论安装和使用其他设备,如扫描仪,CD刻录机,Zip驱动器和物质/反物质流动诱导器。(好吧,也许我们会为超高级课程保存最后一个!)


原文:

-----------------------------------------------------------------------------------------------------------------------------------------------------------

This is a beginner's course and one of the concepts that newcomers to Linux find different is the idea of a file system in Linux. That is to say, the way data is stored and managed in Linux. Most users are familiar with Files. In the simplest terms possible, one can say that files are just a collection of data items which are stored on a disk. However, the way that those files are stored on a disk can vary depending on several different factors. Speed, security, data redundancy etc...

Linux Supports lots of different types of File System formats. Here are just a few...

Ext2: This is like UNIX file system. It has the concepts of blocks, inodes and directories.

Ext3: It is backwards compatible with the ext2 file system, except that it has added journal ing capabilities. Journalling allows fast file system recovery. Includes support for Access Control Lists (ACL).

Isofs: Used by CDROM file system (iso9660).

Procfs: The proc file system acts as an interface to internal data structures in the kernel. It can be used to obtain information about the system and to change certain kernel parameters at runtime using sysctl command.

Mounting file systems

In this part of the lesson about file systems we'll learn how to use the commands mount and umount

We've mentioned previously that there's a different idea in Linux as to what constitutes a floppy disk drive, a CD-ROM drive and another partition of your hard disk (the Windows partition, for example). Though some windows managers for Linux have provisions for clicking on an icon to access a floppy drive, for example, the method behind this is quite different from other OSes. In Linux the floppy drive or other device must be "mounted". That means basically, incorporating it temporarily into your Linux file system or, in other words, telling Linux that it is a file to be written to or copied from.

You can use the mount command to copy to and from other devices.

If you would like to get some files from a CD-ROM, the standard command to do this is:

Code:
mount -t iso9660 /dev/hdb /cdrom
The type, iso9660 is the standard file system for a CD. The device (/dev/hdb) is the non-SCSI type of CD-ROM and the mount point (/cdrom) should exist. If it doesn't, you should create it in the root directory with 'mkdir', just as you may have done with the /floppy directory.

Remember that the concept of CD-ROM is read only. You won't be able to write to this type of CD-ROM drive. A message will tell you that when you mount this type of device.

Mounting another partition of the hard disk.

Many people may have preferred to install Linux along with another operating system. You may have Linux and Windows installed in the same computer. If you would like to access files on the Windows partition you would type the following command:

Code:
mount -t vfat /dev/hda1 /mnt
Windows is always in the primary partition, so that's why we've used the device /hda1 (hard disk partition 1). The choice for /mnt is the standard mount point in this case. You may use the /mnt directory to mount the other devices (floppies, CDs) as well. I use the different empty directories (/floppy /cdrom /mnt) to avoid confusion.

If you change to the mount directory (cd /mnt) and then type: ls and you'll see something interesting. The directories are blue but the files are green (or red - depending on your distribution of Linux). You won't have the various color combinations as you do in Linux. That's because Windows' file system doesn't distinguish file types. Everything looks like it's a program (binary) instead of a regular file.

When you copy files from the Windows partition to the Linux partition you should bear this in mind. For example, if you wanted to copy an mp3 file from the Windows partition to the Linux partition to test out your sound configuration, it would show up as a executable program and not just a standard file under Linux. This doesn't effect your playing it, but for a more accurate accounting of what you have on your system, you may want to change the permissions of the file so that it shows up as a regular file in your color scheme. We'll talk about file permissions and and making changes to them shortly.

Unmounting



Mounting file systems that aren't part of the standard Linux system is considered a temporary condition in Linux. Now that we know how to mount these outside file systems in Linux, the important thing now is to learn how to unmount it when we're finished using it.

In the early days of Linux, you could do serious damage to your system if you didn't unmount manually after you were finished. Nowadays if you have mounted a system and you shut down the computer without unmounting, the chances are pretty slim that you're going to trash a file system. Slim, however, isn't good enough for me. I'd rather not take a chance. I always take the time to unmount these external file systems when I'm finished with them.

The command for this is:

Code:
umount [/mount point]
In the examples I used in this lesson, the mount points were:

Code:
floppy:        /floppy    - therefore umount /floppy
CD:            /cdrom        - umount /cdrom
Windows partition            - umount /mnt
Remember also to NOT be accessing the disk. when you use umount or it will give you a drive busymessage. If you get this, you may have left a terminal open where you were using to copy or write to the particular drive. Check your terminals if you get this error.

I just wanted to point out another thing too. You are 'unmounting' but the command is umount (that is, without theN of un) Being u(n)familiar with the mount concept when I started with Linux, I typed unmount instead of umountand much to my surprise, I got the message: command not found. U(n)deniably, I had done something wrong. It took me a while to figure out that the command didn't include an N. I haven't really done a survey on how many people have actually done this. For all I know, I may be the only person who has, but I just thought it best to warn you.

Well, now you can use the standard devices that most PC users need. Later in our advanced class we'll talk about installing and using other devices like scanners, CD writers, Zip drives and matter/anti-matter flow inducers. (well, maybe we'll save that last one for the super-advanced classes!)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值