Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 18. Sharing a mount on multiple mount points
As a system administrator, you can duplicate mount points to make the file systems accessible from multiple directories.
18.2. Creating a private mount point duplicate Link kopierenLink in die Zwischenablage kopiert!
Duplicate a mount point as a private mount. File systems that you later mount under the duplicate or the original mount point are not reflected in the other.
Procedure
Create a virtual file system (VFS) node from the original mount point:
mount --bind original-dir original-dir
# mount --bind original-dir original-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow Mark the original mount point as private:
mount --make-private original-dir
# mount --make-private original-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, to change the mount type for the selected mount point and all mount points under it, use the
--make-rprivateoption instead of--make-private.Create the duplicate:
mount --bind original-dir duplicate-dir
# mount --bind original-dir duplicate-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 18.1. Duplicating /media into /mnt as a private mount point
Create a VFS node from the
/mediadirectory:mount --bind /media /media
# mount --bind /media /mediaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Mark the
/mediadirectory as private:mount --make-private /media
# mount --make-private /mediaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create its duplicate in
/mnt:mount --bind /media /mnt
# mount --bind /media /mntCopy to Clipboard Copied! Toggle word wrap Toggle overflow It is now possible to verify that
/mediaand/mntshare content but none of the mounts within/mediaappear in/mnt. For example, if the CD-ROM drive contains non-empty media and the/media/cdrom/directory exists, use:mount /dev/cdrom /media/cdrom ls /media/cdrom ls /mnt/cdrom
# mount /dev/cdrom /media/cdrom # ls /media/cdrom EFI GPL isolinux LiveOS # ls /mnt/cdrom #Copy to Clipboard Copied! Toggle word wrap Toggle overflow It is also possible to verify that file systems mounted in the
/mntdirectory are not reflected in/media. For example, if a non-empty USB flash drive that uses the/dev/sdc1device is plugged in and the/mnt/flashdisk/directory is present, use:mount /dev/sdc1 /mnt/flashdisk ls /media/flashdisk ls /mnt/flashdisk
# mount /dev/sdc1 /mnt/flashdisk # ls /media/flashdisk # ls /mnt/flashdisk en-US publican.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow
18.4. Creating a slave mount point duplicate Link kopierenLink in die Zwischenablage kopiert!
Duplicate a mount point as a slave mount type. File systems that you later mount under the original mount point are reflected in the duplicate but not the other way around.
Procedure
Create a virtual file system (VFS) node from the original mount point:
mount --bind original-dir original-dir
# mount --bind original-dir original-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow Mark the original mount point as shared:
mount --make-shared original-dir
# mount --make-shared original-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, to change the mount type for the selected mount point and all mount points under it, use the
--make-rsharedoption instead of--make-shared.Create the duplicate and mark it as the
slavetype:mount --bind original-dir duplicate-dir mount --make-slave duplicate-dir
# mount --bind original-dir duplicate-dir # mount --make-slave duplicate-dirCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 18.3. Duplicating /media into /mnt as a slave mount point
This example shows how to get the content of the /media directory to appear in /mnt as well, but without any mounts in the /mnt directory to be reflected in /media.
Create a VFS node from the
/mediadirectory:mount --bind /media /media
# mount --bind /media /mediaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Mark the
/mediadirectory as shared:mount --make-shared /media
# mount --make-shared /mediaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create its duplicate in
/mntand mark it asslave:mount --bind /media /mnt mount --make-slave /mnt
# mount --bind /media /mnt # mount --make-slave /mntCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that a mount within
/mediaalso appears in/mnt. For example, if the CD-ROM drive contains non-empty media and the/media/cdrom/directory exists, use:mount /dev/cdrom /media/cdrom ls /media/cdrom ls /mnt/cdrom
# mount /dev/cdrom /media/cdrom # ls /media/cdrom EFI GPL isolinux LiveOS # ls /mnt/cdrom EFI GPL isolinux LiveOSCopy to Clipboard Copied! Toggle word wrap Toggle overflow Also verify that file systems mounted in the
/mntdirectory are not reflected in/media. For example, if a non-empty USB flash drive that uses the/dev/sdc1device is plugged in and the/mnt/flashdisk/directory is present, use:mount /dev/sdc1 /mnt/flashdisk ls /media/flashdisk ls /mnt/flashdisk
# mount /dev/sdc1 /mnt/flashdisk # ls /media/flashdisk # ls /mnt/flashdisk en-US publican.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow
18.5. Preventing a mount point from being duplicated Link kopierenLink in die Zwischenablage kopiert!
Mark a mount point as unbindable so that it is not possible to duplicate it in another mount point.
Procedure
To change the type of a mount point to an unbindable mount, use:
mount --bind mount-point mount-point mount --make-unbindable mount-point
# mount --bind mount-point mount-point # mount --make-unbindable mount-pointCopy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, to change the mount type for the selected mount point and all mount points under it, use the
--make-runbindableoption instead of--make-unbindable.Any subsequent attempt to make a duplicate of this mount fails with the following error:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 18.4. Preventing /media from being duplicated
To prevent the
/mediadirectory from being shared, use:mount --bind /media /media mount --make-unbindable /media
# mount --bind /media /media # mount --make-unbindable /mediaCopy to Clipboard Copied! Toggle word wrap Toggle overflow