How to set up smartphones and PCs. Informational portal
  • home
  • Interesting
  • Mount the ubuntu partition. Mounting on Linux systems, what it is and why you need it

Mount the ubuntu partition. Mounting on Linux systems, what it is and why you need it

If Linux and Windows are used in parallel on the computer, it may be necessary to work with the ntfs partition while in Linux. In order for ubuntu to work with disks in the ntfs file system, you need to install the ntfs-3g driver

sudo aptitude install ntfs-3g ntfs-config

(There is a graphical configurator for the driver. Runs with the sudo ntfs-config command. I can’t say anything, I didn’t use it.)

For convenience, you need to set up automatic mounting of a partition (or hard drive) from Windows when booting ubuntu. To do this, you need to mount the partition by adding the necessary parameters to the configuration file /etc/fstab.

First, let's find out the name of your Windows partition. You can see the list of disks with the mount command (more

For this example, the partition in ntfs will be denoted as /dev/sda1

Now you need to determine the disk identifier /dev/sda1 (UUID) using the command ls -l /dev/disk/by-uuid/ or sudo blkid

The UUID is written to /etc/fstab instead of /dev/sda1. For example, take the value UUID=363C991F3C98DAE7

Now we need to create a directory in which we will mount the ntfs partition. You can mount to any directory, even on the desktop, but for convenience it's better to choose /media/. The directory in which we will mount the partition with Windows will be called windows

Create a directory with sudo mkdir /media/windows/

Just in case, we make a copy of fstab with the command sudo cp /etc/fstab /etc/fstab.backup

Open /etc/fstab with sudo gedit /etc/fstab and add to

ntfs partition settings file

UUID=363C991F3C98DAE7 /media/windows/ ntfs-3g users,defaults,umask=0 0 0

You can change these values ​​in /etc/fstab if needed. Let's consider them in more detail.

/dev/sda1 is a physical disk or partition with Windows. Each device has its own number. /dev/sda1 is numbered 1.

If you mount a cd or dvd it will be listed as /dev/cdrom. Drive as /dev/fd

Hard drives are labeled as follows:

IDE: primary master is designated as /dev/hda

primary slave is designated as /dev/hdb

secondary master is designated as /dev/hdc

secondary slave is designated as /dev/hdd

SCSI/SATA is listed as /dev/sd

/media/windows/ is the mount point of the windows partition. Through it, the section will be accessed.

ntfs-3g is the file system in NTFS. For cd/dvd it is written as iso9660, udf. For

disk drives, flash drives and fat32 - vfat

Parameters that determine how this file system will be processed (written with commas, no spaces):

users - permission for users to mount and unmount this directory (some say user. I don't know what the difference is)

defaults - default parameters (exec, auto, rw, nouser parameters are used)

Extra options:

exec - running executable files is allowed (enabled by default)

noexec - execution of executable files is prohibited.

auto - automatically mount the partition on system boot. (enabled by default)

noauto - the partition will not be automatically mounted on system boot.

ro - mount a read-only partition.

rw - mount a partition with read/write permissions (enabled by default)

nouser - prohibits ordinary

users to mount and dismount the partition (enabled by default).

suid and nosuid - enable and disable suid and sgid bits

sync and async - determines how writing / reading occurs in the file system. Synchronously and asynchronously.

locale=ru_RU.UTF-8 - can be added if there are problems with the language.

Then comes the backup flag. 1 - when backing up, the dump program will include this partition. 0 - this section will not be included during backup.

And behind it is a check flag that, when mounted, sets the order in which the partition is checked for errors.

To view mounted partitions, use the mount -l command.

You can view /etc/fstab in the console with the command cat /etc/fstab

On different computers, the settings in /etc/fstab are not the same. Yours may be different. The above configuration can work on one

car and not make money on another. If errors occur, read what is written in the error output. Change parameters, try to use values ​​taken from /etc/fstab files of other users.

Automatically mounted partitions Windows (NTFS and FAT32). This makes it much easier to access them.

To do this, we need to edit the file FSTAB- it describes all the file systems that are used.

Editing fstab manually

We register in the terminal as a superuser:

Now we know which partitions are mounted, under what "name" and what file systems (for example - /dev/sda5 this is the Linux partition, /dev/sda4- chapter NTFS).

Now it remains for us to find out how the devices that we want to automatically mount are marked. For this we open "Disk Utility". She is situated: "System" ? "Administration" ? "Disk Utility"

The screenshot shows that the section is called koskvand marked /dev/sdb1 . Let's start mounting.

Open the FSTAB file for editing by running the command:

# nano /etc/fstab

Add the following line to the FSTAB file:

/dev/sdb1 -> /media/created folder name folder -> ntfs users,defaults,umask=000 0 0

Where /dev/sda6 - indicate the number of the section;/mnt/folder name - the path to the folder we created into which our partition will be mounted; ntfs- type of mounted partition (in this case, we mount the partition NTFS); sign-> I marked the Tab sign (This is important not a space, but a sign Tab).

In this case, the command will look like this:

/dev/sdb1 /media/koskv ntfs users,defaults,umask=000 0 0

Detailed transcript

The first field is the name of the device (local or network) to mount.

The second field is the directory where the device is mounted.

The third field is the file system type ( ext2, ext3, vfat, iso9660, nfs, swap, ignore, etc).

The fourth field is a comma-separated list of options. Many options depend on the FS on the partition, the list of the most common options is:

  • async - asynchronous writing to the FS;
  • auto - automatic mounting when a partition is found or when the mount -a command is executed;
  • defaults - default set of options: async, auto, dev, exec, nouser, rw, suid;
  • exec - execution of programs, scripts;
  • gid=ID – assignment of group ID;
  • uid=ID – user ID assignment;
  • noauto - disable automatic mounting;
  • nouser - allows mounts only to the root user;
  • owner - the owner of the partition being mounted automatically becomes the user who performs the mounts (by default, root);
  • ro - mount in read-only mode;
  • rw - mount in read-write mode;
  • suid - Allow applications to change the user or group ID.

Fifth field - instructing the dump application to backup for a given partition

The sixth field is an instruction to the fsck application to check the partition for integrity when the OS boots

Everything is described in more detail in man mount.

Reboot and use the mounted partitions!

You can check if the partitions are mounted by running the command:

Or download from here and install. (Tested on Ubuntu 10.10)

If the installer requires installation Python2.6 then install it:

# sudo add-apt-repository ppa:fkrull/deadsnakes
# sudo apt-get update
# sudo apt-get install python2.6 python2.6-dev

After installation, run "System" ? "Administration" ? "Disk manager". The application can conveniently display information about each of the available partitions (name, FS type, size) or general information (how many partitions, total size on all disks, etc.). All operations on mounting/unmounting, specifying options occur in the application window. For each section disk manager offers a mount point and options that can be tweaked or left as is. Checkbox in a column enable writes all changes to /etc/fstab.

Automatic fstab editing - MountManager

Another GUI mount/unmount application is . There will be more options for settings compared to the previous software - which allows you to configure mounts more flexibly, there is a short description of the terms, which will be the most for beginners.

Install Mount Manager in ubuntu you can from the official repository with the command:

# sudo apt-get install mountmanager

When you first start the program, you will get the following window:

  • Specify mount options for different partitions;
  • Show all logical disks of a physical disk;
  • Replacing the configuration file /etc/fstab;
  • Explanation of many options and other mount settings;
  • System for restoring previous configuration files;
  • Mounting images;
  • Extension support;
  • Create rules for udev;
  • Mount NFS share;
  • Mount Samba share;
  • Etc.

To disable the display of mounted disk icons on the desktop, you need to: run gconf-editor, go to /apps/nautilus/desktop/ and opposite the entry volumes_visible remove the checkbox. Unfortunately, icons for all mounted devices disappear, but I would like flash drives, cd/dvd remained.

I recently found another simple way to automatically mount on the Internet. When I find the link from where I got it, I'll write it here... We do everything manually:

1. We go to all the necessary disks through Nautilus. Thus, they are temporarily mounted.

2. Open, you can use the terminal file /etc/mtab

# sudo gedit /etc/mtab

3. We find a line with a description of the mounted disk, by analogy as in the picture:

4. Select all that description and add it all to the end of the file /etc/fstab

Good luck!

If you need to connect/mount a hard disk with NTFS or ext2, ext3 file system to a computer based on Linux operating system, then you are reading the right article.

Why do it by hand when modern Linux desktop systems do it automatically?

There are some cases where the system linux cannot automatically mount/mount the disk due to some logical disk failures, viruses that infect NTFS/FAT partitions, or because of something else anomalous. To do this, real system administrators do it by hand. And they do it with the mount command.

The Linux mount command is a very flexible tool in the hands of a system administrator. You can use the mount command to mount a network drive, a hard disk partition, or a USB drive.

This article is not a complete, exhaustive description of the mount command (a complete description of the mount command can be found by running the command man mount in the console), but strive to do so. The article on the description of the mount command is constantly being finalized and modified. All suggestions for the article can be left in the comments.

Devices that are currently connected to the computer can be viewed by typing in the console:

This command shows all devices that are connected. They may not be mounted, but connected. On the screen you will see something like this:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders

Disk identifier: 0x815aa99a Partition table entries not in disk order
Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x973248ad

Load Device Start End Blocks Id System
/dev/sdb1 * 1 9729 78148161 83 Linux

Disk /dev/sdc: 1027 MB, 1027604480 bytes
32 heads, 62 sectors/track, 1011 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Disk identifier: 0x6f20736b

From the listing above, you can see that the following is connected to the operating system:

  1. two hard drives: /dev/sda - operating system and /dev/sdb - "file dump"
  2. removable USB media: /dev/sdc
Viewing mounted devices is carried out with the command:

After that, you can see on the screen:

/dev/sda1 on / type reiserfs (rw,relatime,notail) tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
lrm on /lib/modules/2.6.27-14-generic/volatile type tmpfs (rw,mode=755)
/dev/sda3 on /home type ext3 (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/user/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=user)
/dev/sdc on /media/USBFlash type vfat (rw,nosuid,nodev,uhelper=hal, shortname=mixed,uid=1000,utf8, umask=077,flush)

  • the first line says that the root FS is reiserfs file system with mount options: read and write access (rw)
  • /dev/sda3 is the /home disk partition
  • /dev/sdc is a mounted removable USB device
The same result can be achieved by looking at the contents of the /etc/mtab file (on some Linux systems, the file is /etc/mnt/tab)
  • hummingbird
    27 March, 09:27

    after I entered this command: sudo chmod -R 0777 /home/roza/Desktop There were no error messages in Debian, but in Mint, during boot, a message appears with the following content:

    The user's $HOME/.dmrc file has incorrect permissions and is ignored. This prevents the session and default language from being saved. This file must be owned by a user and the file must have permission 0644. The user's home folder ($HOME) must be owned by the user and must not be writable by other users.

    Then everything freezes for a few seconds and the desktop opens. And here I can’t use either sudo or just su - the terminal swears not in Russian. Is it possible to restore the rights to ($HOME). Can I do this using the Mint live disk?

  • [email protected]
    29 March, 12:13

    Hummingbird: Then everything freezes for a few seconds and the desktop opens. And here I can’t use either sudo or just su - the terminal swears not in Russian. Is it possible to restore the rights to ($HOME). Can I do this using the Mint live disk?

    Well, try to return the rights back:
    sudo chmod -R 0644 /home/roza/Desktop

    And the owner:
    sudo chown -R YOUR_LOGIN_IN_MINT /home/roza/Desktop

  • hummingbird
    April 2, 08:43
  • [email protected]
    April 3, 13:39

    Hummingbird: All the same, nothing happened :(. In general, I reinstalled the partition with mint. The main thing is that I learned how to mount partitions (I understood how it is done, then it’s easier) And I also learned a lesson for myself - you need to distribute rights very carefully. In any case, thanks!

    P.S. The main thing is that you have learned something))

  • Alex Under Construction
    19 May, 08:41

    Thanks.
    A couple of additions.
    1. For example, my hard disk partition did not want to be mounted after connecting to a Windows machine that was infected with viruses. It so happened that the virus threw autorun.exe into the root of my partition and Linux did not want to mount this partition because of this.
    I didn’t want to mount it not because of autorun.exe, but because most likely the Windows were extinguished “incorrectly” and the byte about checking the integrity of the file system remained on ntfs. In this regard, ntfs3g without “force” is afraid to mount such a file system, so as not to damage it.
    2. Since there is a section about “ SMB”, It would be worth mentioning CIFS.
    And as an example, give something like:
    mount -t cifs -o username=domain\user //remote-win2k3-server/C$ /mnt/smb/

  • unimportant
    May 20, 15:26
  • Tonik
    24 May, 03:04
  • [email protected]
    26 May, 17:27

    Alex Under Construction: Thanks. A couple of extras. 1. For example, my hard disk partition did not want to be mounted after connecting to a Windows machine that was infected with viruses. It so happened that the virus threw autorun.exe into the root of my partition and Linux did not want to mount this partition because of this. I didn’t want to mount it not because of autorun.exe, but because most likely the Windows were extinguished “incorrectly” and the byte about checking the integrity of the file system remained on ntfs. In this regard, ntfs3g without “force” is afraid to mount such a file system, so as not to damage it. 2. Since there is a section about “SMB”, it would be worth mentioning CIFS. And as an example, give something like: mount -t cifs -o username=domain\user //remote-win2k3-server/C$ /mnt/smb/

    Not important: It would be nice if NFS mount was also described

    Thanks for the comment. I'll make additions.

    tonic: But the article helped me. Elementary! - I forgot how to mount ... I quickly ran through the article, and remembered. Thanks a lot to the author!

    Come back often :)

  • Denis
    11 June, 11:47

    Thank you for the article,
    och. intelligibly

  • Ludmila
    July 9, 13:05

    # sudo mount -t smbfs -o username=vasja,password=pupkin //pupkin_v/Video /home/user/video
    does not work, gives help
    usage: ……
    I work in ubuntu. you need to connect the shared windows folder
    Maybe the team is wrong?

  • [email protected]
    July 9, 22:11

    Ludmila:# sudo mount -t smbfs -o username=vasja,password=pupkin //pupkin_v/Video /home/user/video doesn't work, gives help usage: …… working in ubuntu. you need to connect the shared windows folder Maybe the command is wrong?

    Line
    username=vasja,password=pupkin
    must be replaced with the required parameters. If you connect on behalf of a guest, then you need to be careful there, there are nuances and differences between the Russian and English Windows OS

  • Andrey
    31 August, 10:04

    In ubuntu you need this:
    mount -t cifs -o username=tridge,password=foobar //fjall/test /mnt/smb/fjall

  • CJ
    14 September, 20:28

    [email protected]:~$ sudo umount /dev/sda1
    umount: /:device is busy. (In some useful cases info about processes that use the device is found by lsof(8) or fuser(1))
    [email protected]:~$ df -h
    File system Size Use Ext Use% is mounted on
    /dev/sdb1 26G 9.1G 16G 37% /
    none 1.7G 416K 1.7G 1% /dev
    none 1.7G 0 1.7G 0% /dev/shm
    none 1.7G 200K 1.7G 1% /var/run
    none 1.7G 0 1.7G 0% /var/lock
    none 1.7G 0 1.7G 0% /lib/init/rw
    /dev/sdb6 33G 15G 19G 45% /media/4403D3D754B7C8F5
    /dev/sdb5 30G 22G 8.1G 74% /media/Win7
    /dev/sda5 50G 8.9G 41G 18% /media/Other
    /dev/sdc1 373G 372G 946M 100% /media/STORAGE
    /dev/sdb7 94G 88G 5.5G 95% /media/MUSIC & GAMES
    /dev/sda1 26G 9.1G 16G 37% /

  • Vladimir
    15 September, 09:46
  • [email protected]
    19 September, 20:14

    CJ: The /dev/sda1 drive needs to be mounted, but it claims to be already mounted at “/”, even though Ubuntu's system partition is mounted at that point. Tell me what to do, I'm already tormented :(

    You can show the output of the command:
    sudo fdisk -l

    Vladimir:
    The only remark is the use errors tsya / tsya.-TSYA or -TSYA? Thanks again.:)

    It could be ;) Will need to get the attention of your editor ;)

  • Taras
    27 September, 06:59
  • [email protected]
    30 September, 06:46

    Taras: The samba mount command does not work.

    What exactly does not work in it?

  • Roman
    November 2, 20:41

    And if the file system is LWM2, and Linux Mint swears?!
    i.e. the command sudo mount -t lwm2 /dev/sdb /home/user/Video is not accepted.

  • zzzubr
    November 2, 22:52

    [email protected]: sudo mount -t ext3 -o rw /dev/hda3 /home/roza/Desktop
    So? So the mount point is /home/roza/Desktop?

    If everything is mounted for you and the /dev/hda3 file system is visible, but you do not have enough rights, then you just need to add these rights:
    sudo chmod -R 0777 /home/roza/Desktop

    mmm ... it seems to me .. that it was not a very good way ... it would be more correct to enter from the root, because in this way you gave rights to everyone and everything ... and this is not good ...

    IMHO! although they say that there are a million articles, anyway, the article is good) though there are not enough examples ... I would like to see some non-standard chtoli applications ... because everything is easier to digest by examples)
    November 29, 20:33

  • [email protected]
    5 December, 19:34

    max: It was Windows, the hard drive was divided into 4 logical disks (c, d, e, f). I installed ubuntu 10.04 on the “c” drive, thereby demolishing Windows. Now there is no access and I can not see the rest of the logical drives. Please tell me what to do to get access to them?

  • Ihor
    6 December, 14:41

    >
    >

  • [email protected]
    14 December, 10:48

    ihor:> Mounting hard disk partitions
    > ... You can take any mount point.
    It seems that in the Big Red Book (I also heard “from Nemeth”) it says: “... it is desirable that there are no files in the folder where you mount, because they will not be visible.”

    Well, it goes without saying.

  • cartoon
    7 January, 22:06

    Mounted iso image

    # sudo mount -t iso9660 -o loop /home/op/iso/1.iso /home/op/disk

    Writes Russian file names with krakozyabry.

  • umnik
    29 March, 16:15

    there are a lot of articles and books, but I see it for the first time, humanly written, so to speak, on the fingers, shown and told, many thanks to the author, I found a bit for myself, but I couldn’t understand and find this bit for several years. The author is worthy of respect, if such an article fell into my hands about 7 years ago, when I started to surf the expanses of Linux, I would be very happy.

    All told

  • Zlobik
    18 August, 08:09

    Can you please tell me how to clean the mount tails? Thanks.

  • neon
    12 January, 23:29

    A funny thing happened to me here. Tried to make a bootable USB flash drive. formatted the flash with the mkfs command, then according to the recommendations of some “advanced” users. installed the gparted application, gave the flash drive a bootable (active) flag ... And after that miracles began:
    1. the problem is that the mount & umount commands have disappeared
    2. The team was restored, but there is another trouble. when mounting a partition (no matter with which system), the fs is connected in read mode, it is not possible to change access rights. The system simply does not respond to these command keys and says everything is in order, the operation was successful.

    Conclusion I can pick up files from any medium, I can’t give files. I read the article with fstab. Rewrote the file by hand. Didn't make any more changes to it. But an attempt to mount a disk with write and execute permissions still failed. After I demolished gparted and rebooted the system, the fstab file I edited began to work correctly and the mount commands were restored.

    Attention to the question: What is the reason for this behavior of gparted and how did he do it? Well, how to deal with this without deleting gparted?

  • Agatha
    21 January, 23:07

    Great, intelligible articles: this one, “.. SWAP in Linux”, “..what is fstab?”!
    Dear author, please write a couple more, covering such topics as: partitioning, disk partitioning, merging partitions, transferring home to another partition.
    It would be a great collection!

  • Alexander
    7 April, 00:35

    Is it possible to somehow get the source code of this miracle program

  • sbp
    29 June, 01:27

    Tell me what to do?
    Installed Ubuntu12.04 a week ago. After some careless actions, the system crashed. There is 250GB of information on the disk. LiveCD HD sees, but does not start (gives an error). And there is no way to connect it. Here is the result (even in this variant) -
    [email protected]:~# sudo mount -t ext4 -o force /dev/sda1 /
    mount: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error In some cases, useful information can be found in the syslog - try dmesg | tail or something like that

    I tried to restore the system performance according to the recommendations from the sites, but to no avail. When booting from disk, indicates that the boot manager did not detect an operating system.
    Tell me what to do ?, where to "run" ?.

  • cinema
    25 October, 23:50

    Good afternoon. There is a server for a film projector on linux. differs from the usual ones in that it has a Digital Cinema program for showing films through a projector. The motherboard recently died, changed, put another one. Everything has been reloaded. Now the server does not see the portable SATA hard drive. it is connected using a sled to transfer movies to the server (1 movie weighs from 90 to 300 GB). Tell me, plz, through the mount command, can I make it so that he would see it? (power is supplied to the disk, all loops are connected, but it still does not see the disk)

  • Let's see how to mount a hard drive in Ubuntu. To do this, you need to perform three steps:

    1. Create a partition on the hard drive.
    2. Disk formatting.
    3. Mounting a disk in the system.

    We use the fdisk utility. You can view the list of disks connected to the computer with the command:

    The command outputs text similar to the following:

    Disk /dev/sda: 21.5 GB, 21474836480 bytes
    255 heads, 63 sectors/track, 2610 cylinders



    Disk identifier: 0x000bedde

    Load Device Start End Blocks Id System
    /dev/sda1 * 1 2497 20051968 83 Linux
    /dev/sda2 2497 2611 916481 5 Extended
    /dev/sda5 2497 2611 916480 82 Linux swap / Solaris

    Disk /dev/sdb: 2147 MB, 2147483648 bytes
    255 heads, 63 sectors/track, 261 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    /dev/sdb does not have a valid partition table

    We have two disks, sda and sdb. There are already three partitions on sda and sdb is not partitioned. To create partitions on sdb, run the command:

    You will be prompted to enter `m` for help, enter and see what options there are for working with the disk

    Command action
    a toggle boot flag
    b edit disk label bsd
    c toggle dos compatibility flag
    d delete partition
    l list of known file system types
    m display this menu
    n adding a new partition
    o creating a new empty DOS partition table
    p output partition table
    q exit without saving changes
    s create a new Sun clean disk label
    t change partition system id
    u change screen/content units
    v checking the partition table
    w write partition table to disk and exit
    x additional functionality (experts only)

    Enter `n` i.e. add a new section

    Command (m for reference): n
    Command action
    e extended
    p main partition (1-4)

    Select the main one by pressing `p`

    Section number (1-4):

    We put the section number, no matter which one, but for the order, 1 is better (if it is not busy, of course). This figure means what your disk will be called sdb1 or sdb2 and so on.

    First cylinder (1-261, default 1):
    Default value 1 is used
    Last cylinder, +cylinders or +size(K,M,G) (1-261, default 261):
    Default value 261 is used

    Command (m for reference): w
    The partition table has been changed!

    Called ioctl() to reread the partition table.
    Disks are synced.

    We have created the partition, now we need to format it. Let's use the command mkfs

    Its format is simple mkfs.filesystem device

    For example, we need to format our /dev/sdb1 in ext4, to do this, run the following command:

    mkfs.ext4 /dev/sdb1

    and wait for our disk to be formatted.

    Now let's actually mount our disk. Let's do this with the command mount

    mount -t ext4 /dev/sdb1 /usr/data

    -t ext4- specify the file system of the mounted disk

    /dev/sdb1- Actually, the section itself that we connect

    /usr/data- The mount point is the place where our partition is connected

    You can unmount the disk with the command umount specifying a disk

    umount /dev/sdb1

    In order for the disk to be mounted in the system automatically after a reboot, you must specify it in the /etc/fstab file. Go to a new line and add a line like this:
    hard_partition mount_point file_system mount_options two_auxiliary_numbers. For example, to describe our /dev/sdb1 partition with the ext4 file system, add the following line:

    /dev/sdb1 /usr/data ext4 defaults 1 2

    where, /dev/sdb1- our partition, disk, device call it whatever you want

    /usr/data- mount point where the files from our disk will be

    ext4- file system, on a mounted disk

    defaults- all default options. Read their description below.

    1 2 - Auxiliary numbers, also read the description below

    Options table:

    Option Description
    defaults Use default settings. That is, these are: rw,suid,dev,exec,auto,nouser,async.
    rw/ro Read and write allowed / Read only allowed
    suid / nosuid Allow / Block work suid, and sgid bit
    dev/nodev Interpret / do not interpret the special device block on the file system.
    exec / noexec Allow executing binary files located on this drive / Deny
    auto/noauto The device will install automatically on boot / Will not
    user / user Prohibit mounting from everyone except root (nouser) / Permission to mount on behalf of any user
    async / sync Writing and reading to the disk will be done asynchronously / Synchronously

    Auxiliary numbers.

    And now about the problem, which is inherent in all Debian distributions (Ubuntu included).

    If the resources are mounted using the above method, then when you reboot or shut down the system, you will see the following message:

    1.CIFS VFS: No Response for Cmd mid

    This is due to the fact that all services are first disabled (S20sendsigs), and then an attempt is made to unmount network resources (S31umountnfs.sh). But the services are already disabled. I also encountered this problem with Ubuntu 8.04. It remained in Ubuntu 9.04.

    To fix it, you need to edit the runlevels, namely rc0 and rc6. To do this, run the commands:

    cd /etc/rc0.d

    The same steps must be done in the rc6.d directory

    cd /etc/rc6.d
    sudo mv S31umountnfs.sh S19umountnfs.sh

    Now, when shutting down or rebooting the system, network resources will first be unmounted, and then services will be disabled.

    mount

    From Wikipedia, the free encyclopedia

    Usage

    mount /dev/cdrom /mnt/cdrom Device /dev/cdrom mounted to directory /mnt/cdrom if it exists. Starting from the moment of mounting and until the user unmounts the file system (or something else is mounted there) in the directory /mnt/cdrom will contain the device directory tree /dev/cdrom; those files and subdirectories that used to be in /mnt/cdrom, will be saved, but will not be available until the device is unmounted /dev/cdrom.

    Unmounting with the umount command

    To unmount, just specify the mount point or device name.
    umount /dev/cdrom

    Mounting USB drives

    For the common case where the USB drive has a FAT32 file system, the mount command looks like this:
    mount -t vfat -o codepage=866,iocharset=utf8 /dev/sda1 /mnt The codepage parameter is required so that the names of the created files are correctly displayed in older operating systems (eg DOS). If the distribution kit uses a non-UTF-8 system locale as an encoding, then it must be specified in the iocharset parameter like this:
    mount -t vfat -o codepage=866,iocharset=koi8-r /dev/sda1 /mnt The actual encoding used can be determined by running the locale command.
    Useful options when mounting Flash drives are sync and flush . The first causes the write buffer to be permanently flushed to disk, so that data is not lost when the flash disk is detached without unmounting. A side effect of this mounting is a significant reduction in write speed. The second option (only available in newer Linux kernels) causes the buffer to be flushed to disk after the last file has been written. It also contributes to saving data in case the disk is removed without unmounting, but does not lead to a drop in write speed.

    Mounting NTFS drives/partitions

    mount -t ntfs -o noatime,users,rw,fmask=111,dmask=000,locale=ru_RU.UTF-8 /dev/sda1 /mnt/win_xp

    Mounting disk images

    If you have a disk image in the form of an iso file, then to mount it you need to specify the -o loop option and, usually, the file system type -t iso9660 (optional) (file.iso is the name of the image file, and /mnt/iso is the dot mount):
    mount -o loop -t iso9660 file.iso /mnt/iso Mounting non-iso images requires conversion to an iso image or the use of an emulator. For conversion, you can use the command line utilities (see below) or the GUI utility kiso. Mounting Disk Images in Linux

    bin/cue images

    To convert a bin/cue image to an iso image, you can use the bchunk converter:
    bchunk image.bin image.cue image.iso

    Mounting NFS network drives

    mount 172.22.2.1:/mnt/iso/ /mnt/iso/

    Mounting SMB network drives

    An example of mounting SMB network resources:
    mount -t smbfs -o username=user,password=pass //server/dir /mnt/localdir/ mount -t cifs -o username=user,password=pass //server/dir /mnt/localdir/ (The smbfs utility has been replaced by in the linux kernel to a compatible cifs.) notes:
    • "-t cifs" can sometimes be omitted if the name of the mounted device is "//server/dir"
    mount //server/dir /mnt/localdir/ -o username=user,password=pass
    • if for authorization it is necessary to specify the user's domain name, then in the parameters of the mount command it is specified as "-o username=domain\\user", however, when specifying a mounted resource in /etc/fstab, the username is specified as "domain/user":
    //server/dir /mnt/localdir/ cifs user=domain/user,password=pass 0 0

    Mounting FTP servers

    curlftpfs -v -o iocharset=UTF-8 ftp://user: [email protected]/ /mnt/ftp

    Mounting a filesystem directory from another computer via ssh

    The Fuse kernel module (was adopted into the official kernel branch since 2.6) allows unprivileged users to mount various filesystems.
    To work, you need to add a user to the fuse group, you can do it like this:
    usermod -G -a fuse user or
    adduser user fuse or by manually editing the /etc/group. It is also necessary that the fuse kernel module is loaded:
    modprobe fuse After that, you can mount another computer's directory using sshfs :
    sshfs [email protected] _server:/tmp ~/udalennaya_papka To unmount, enter the command:
    fusermount -u ~/udalennaya_papka

    Mount Options

    You can optionally specify additional mount options when you run the mount command.

    -t File system type

    Usually it is determined automatically during mounting or taken from the configuration file (see below). But in some cases, you need to specify the file system type explicitly. For example, when mounting a DVD disc with the UDF file system.
    mount /dev/cdrom /mnt/dvd -t udf If the file system type is incorrect, the mount command will give an error message
    mount: wrong fs type, bad option, bad superblock on /dev/cdrom, missing codepage or other error In some cases useful info is found in syslog - try dmesg | tail or so and advise you to look at the end of the system messages file.
    Unable to identify CD-ROM format. In case of a successful mount, it is usually reported that the CD is mounted (by default) in read-only mode.
    mount: block device /dev/cdrom is write-protected, mounting read-only

    -o Access attributes

    • Read-only (ro) or read-write (rw) access
    • Allow or block programs from running (noexec)
    Example 1 (for example, mounting a USB disk is taken):
    mount -t vfat -o rw,noexec,iocharset=utf8,codepage=866 /dev/sda1 /mnt/usb Example 2 (for example, mount an ntfs partition with Windows XP installed):
    mount -t ntfs -o noatime,users,rw,fmask=111,dmask=000,locale=ru_RU.UTF-8 /dev/sda1 /mnt/win_xp Example 3 (remount device with read/write access (rw ))
    mount -o remount,rw /dev/sda2

    mount --bind

    The mount command with the --bind option or the -B short option is used on Linux kernel systems (starting with 2.4.0) to create a directory alias in the file system tree. For example, the command:
    mount --bind /mnt/cdrom/Files /var/ftp/cdrom will allow you to access files from /mnt/cdrom/Files via the /var/ftp/cdrom path, where /var/ftp/cdrom is some already existing (perhaps empty) directory (its actual contents will be inaccessible until unmounted). You can also write -o bind instead of a separate --bind option, which will have a similar effect. It also allows you to add a rule to the /etc/fstab file to mount at system startup:
    /olddir /newdir none bind The advantage of this method of creating directory links over symbolic links is the ability to bypass file system access restrictions imposed on processes running in a chroot environment or chrooted servers. For example, the proftpd FTP server disables symbolic links pointing to files and directories outside the specified directory. The action of the mount --bind command is similar to DOS's subst .

    List of mounted file systems

    Running the mount command without options lists the mounted filesystems:
    /dev/md/5 on / type reiserfs (rw,noatime) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec) udev on /dev type tmpfs (rw,nosuid) devpts on /dev/pts type devpts (rw,nosuid,noexec) /dev/md/4 on /files type xfs (rw,noatime) /dev/sda3 on /mnt/a type ext3 (rw,noatime) /dev/ sdd2 on /mnt/docs type reiserfs (rw,noatime) shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev) usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664 ,devgid=85) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) nfsd on /proc/fs/nfs type nfsd (rw,noexec,nosuid,nodev) //ax2/i on /mnt/smb type smbfs (0) 172.22.2.1:/files on /mnt/files type nfs (rw,addr=172.22.2.1) This example shows many mounted file systems (FS).
    • the first line says that the corresponding lines act as the root FS. Sample content for this file:
      # # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. #/dev/BOOT /boot ext2 noauto,noatime 1 2 /dev/sda5 / reiserfs noatime 0 1 /dev/sda1 none swap sw 0 0 /dev/cdrom /mnt/cdrom iso9660 noauto,ro 0 0 #/dev/fd0 /mnt/floppy auto noauto 0 0 # NOTE: The next line is critical for boot! proc /proc proc defaults 0 0 # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory (shm_open, shm_unlink). # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will # use almost no memory if not populated with files) shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 In the future, it will be possible to specify only the device name or dot in the mount command mount - all additional parameters will be taken from the configuration file. For example, with respect to this configuration, the command mount /mnt/cdrom will be equivalent to executing the command
      mount /dev/cdrom /mnt/cdrom -t iso9660 -o noauto,ro Another purpose of the configuration file is to automatically mount filesystems at system boot. If you do not want to mount certain file systems, you must specify the noauto option in the configuration file for them.

    Top Related Articles