Mounting in linux meaning

What is mounting in Linux? [duplicate]

What does mounting really mean in Linux? And where/when can I use the mount command? I’m new to Linux so I would appreciate a detailed answer.

It isn’t a Linux specific concept, other *nixes use mounting too. Windows, otoh, normaly assigns partitions and drives to a volume letter, so the root of that newly «mounted» partition is the volume letter. In Linux, you could mount the partition or drive to any point in the filesystem, you could mount it in / or /home/user/media. or really any other place.

@SamuelSantana But aren’t external peripherals automatically mounted when plugged in? And why would I want to mount something manually? What is the purpose or the scenarios that make me mount something? Why would I do it myself?

If you are managing a server with no gui, you will need to do this manually, using the mount and umount (that’s right, umount and not unmount) commands. Check my answer. Also, some spartan linuxes, even with a gui, may not use a robust file manager like Nautilus which mounts volumes for you.

@SamuelSantana I see some documentation requiring to mount an iso before the installation of a program. But, how come I mount the iso when I’m already running its OS?! Where’s the logic in this?

2 Answers 2

Mounting isn’t a Linux specific concept: other *nixes do it too. Windows, otoh, assigns devices to a volume letter, so the root of that device is the volume letter. In GNU/Linux distributions, the device could be mounted on any point of the filesystem (well, in Windows too, but that’s another story), it could be mounted right under / or /home/username. or really any other place.

Lets say you insert a USB stick, in some GNU/Linux systems, like Ubuntu Desktop, a daemon may automatically mount it for you, on Ubuntu it will normally mount it under /media/.

You can manually do this. Imagine that for any reason you want to mount the stick under your home directory, we would do it this way:

First, create a dir: mkdir ~/usb_tmp

Then, mount it there: mount /dev/sdb1 ~/usb_tmp .

Note: I use «/dev/sdb1» for this example’s purposes, but this really is a representation of your USB stick and it could vary. You would need to figure that with sudo fdisk -l .

Afterwards you could navigate there, as you would with any other directory, and see the contents of the USB stick.

Источник

What does it mean to mount something?

I hear and read the term all the time, but what does it mean? I just accidentally mounted a shared folder hosted on a remote computer. The only difference I see is the presence of a desktop shortcut. I was able to access the folder before I mounted it with no problems. So What does it mean to mount something?

5 Answers 5

When you ‘mount’ something you are placing access to the file system contained within onto your root file system structure. Effectively giving the files a location. This is similar to the C:/D: drive labels in windows, but more flexible.

Читайте также:  Linux backup all system

Mounting /dev/sdb1 to /mnt/disk1 places all the files and folders contained within the device standard disk B partition 1 into the directory /mnt/disk1 where you can access them.

Modern systems have ways to auto-mount drives just as windows auto-mounts drives to drive letters, but the location mounting system in Unix is much more flexible. And unmounting is obviously the removal of the access to those files/folders from that location. You can find out what file systems are mounted by running the command:

Parts of ubuntu involved: mount, umount, fstab (for fixed mounts), udev, gvfs (for automatic mounting)

Please report this as a new question, I can answer it for you. I’ve added a link to help, but it’s not formatted data.

You know the drives you have in Windows? Like C:/ and D:/ and stuff. One of them is just your hard drive, and one of them is your cd drive, and if you plug in a flash drive or external hard drive, that’ll make another letter appear. Your shared folder is the same; it’s not your computer’s hard drive, it’s some other drive, somewhere else.

Now, that flash drive, and your shared folder, and all of these—they’re not on your computer the second you plug them in, or connect remotely, or whatever. They’re not in your «file system». They have to get thrown into the mix, and your computer has to read them, and know that they’re there, and give you a way to access them. This is «mounting»—plopping the drive into your file system, where you can get to it.

In Windows, when a drive is mounted, Windows will pick another letter, and assign that letter to the drive—and then you can access it from «My Computer». On Unix like systems such as Ubuntu, They go with the much nicer system of placing that icon on your desktop. So when you plug in your flash drive, instead of getting some stupid autorun dialog that is totally annoying and sometimes unsafe, you get a nice icon on your desktop to symbolize the piece of hardware you just stuck into your computer.

Autorun dialogs aren’t stupid — users who choose to execute unsafe contents are. Windows caters to the needs of the masses — who get lost if the installer doesn’t run automatically when you pop in a CD. And some people might find the icon totally annoying (I do) and the autorun dialog not only nice, but also very useful (I don’t). Good thing you can turn off both autorun prompts and desktop icon placement. And «My Computer» is an ancient thing — it has been just «Computer» for quite some time now.

A physical device can be either «unmounted» or «mounted». However, while the «unmounted» state for a physical device still appears on your desktop and still is under Places, a shared folder has a different behavior.

When you connect to a shared folder by using the «Connect to server» menu option, what Ubuntu does is it creates a sort of virtual folder. It’s not actually mounted under «/media», but is using a special virtual network filesystem. In fact this is closer to mapping a network drive under Windows; they do not appear under your C:\ drive, but are instead given a different drive letter, which is basically just a convenient link to the folder. In Ubuntu, the listing under Places and the icon on your desktop is the same, just a convenient link. If you connect to the folder by going through Network, you’re browsing straight to the folder, just like you can in Windows.

Читайте также:  Linux what version is running

You cannot access unmounted filesystems without mounting it first. filesystems and their mount-points are defined within the /etc/fstab file and you can control the mounting operation from there. The syntax of the mount command is.

mount [options] device file mount point

Linux recognizes and can mount several type of file systems ( including windows NTFS) provided you have the right filesystem driver.

What is meant by mounting a drive? Before your computer can use any kind of storage device (such as a hard drive, CD-ROM, or network share), you or your operating system must make it accessible through the computer’s file system. This process is called mounting. You can only access files on mounted media.

Formats and mounting Your computer stores data in specific, structured file formats written on a piece of media (such as a disk or CD-ROM). Your computer must be able to read the format on this media in order to interpret its data properly; if the computer does not recognize the format, it will return errors. Also, forcing your computer to work with corrupted or unrecognized formats will cause it to write data incorrectly, possibly rendering unrecoverable all the files stored on the media.

Mounting ensures that your computer recognizes the media’s format; if your computer cannot recognize that format, the device cannot be mounted. When media is successfully mounted, your computer incorporates the media’s file system into your local file system, and creates a mount point, a locally available link through which you access an external device. In Windows or Mac OS X, the mount point is represented by a disk or other icon; in Unix or Linux, the mount point is a directory. Most operating systems handle mounting and unmounting for you.

Источник

What does it mean to mount a file system in linux?

I was reading somewhere that File systems are ‘mounted’ over a particular directory Then there was an example of a user space file system saying that to mount you have to type ./program.py ~/somedir Can someone please explain the idea of mounting a filesystem in linux?

3 Answers 3

A better way to describe «mount» is «attach».

The filesystem being mounted is attached to an empty directory of the existing filesystem. That is, the top level directory of the mounted filesystem becomes the directory on the existing filesystem.

Subdirectories of the mounted filesystem become the subdirectories of the former directory on the existing filesystem, and so on.

(The directory that was mounted on doesn’t really have to be empty, but after mounting any contents it had are inaccessible, until the filesystem is unmounted).

Unlike on Windows where different file systems have different drive letters like C: and D: , Unix-like filesystems have a single root at / . So when you attach a new disk drive or USB stick to a Linux system, the new filesystem has to exist somewhere in the existing filesystem. In other words, some existing directory must serve as the root of the new filesystem. These directories are known as mount points.

Читайте также:  Linux mint and itunes

For removable drives, the mount points are usually located under /media , but they can be located anywhere. Note that once a filesystem has been mounted over a directory, any files in that directory on the original filesystem are inaccessible until the new filesystem is unmounted.

Mounting a filesystem simply means making the particular filesystem accessible at a certain point in the Linux directory tree. When mounting a filesystem it does not matter if the filesystem is a hard disk partition, CD-ROM, floppy, or USB storage device.

You can mount a file system with mount command. Normally /mnt folder is used for mounting.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

What is meant by mounting a device in Linux?

I’ve heard the term «mounting» when referring to devices in Linux. What is its actual meaning? How it handling now unlike older versions? I haven’t done that manually via the command-line. Can you give the steps (commands) for mounting a simple device in Linux?

4 Answers 4

Unix systems have a single directory tree. All accessible storage must have an associated location in this single directory tree. This is unlike Windows where (in the most common syntax for file paths) there is one directory tree per storage component (drive).

Mounting is the act of associating a storage device to a particular location in the directory tree. For example, when the system boots, a particular storage device (commonly called the root partition) is associated with the root of the directory tree, i.e., that storage device is mounted on / (the root directory).

It’s worth noting that mounting not only associates the device containing the data with a directory, but also with a filesystem driver, which is a piece of code that understands how the data on the device is organized and presents it as files and directories.

Let’s say you now want to access files on a CD-ROM. You must mount the CD-ROM on a location in the directory tree (this may be done automatically when you insert the CD). Let’s say the CD-ROM device is /dev/cdrom and the chosen mount point is /media/cdrom . The corresponding command is

mount /dev/cdrom /media/cdrom 

After that command is run, a file whose location on the CD-ROM is /dir/file is now accessible on your system as /media/cdrom/dir/file . When you’ve finished using the CD, you run the command umount /dev/cdrom or umount /media/cdrom (both will work; typical desktop environments will do this when you click on the “eject” or ”safely remove” button).

Mounting applies to anything that is made accessible as files, not just actual storage devices. For example, all Linux systems have a special filesystem mounted under /proc . That filesystem (called proc ) does not have underlying storage: the files in it give information about running processes and various other system information; the information is provided directly by the kernel from its in-memory data structures.

Источник

Оцените статью
Adblock
detector