Skip to main content
edited body
Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount  # run a shell in a new mount namespace

# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp 

# exit  # exit the shell, and hence the mount namespace

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, the root mount is replaced and you work with an entirely separate tree of mounts. This involves some extra details, such as the pivot_root() system call. You probably don't need to know exactly how to do that. Some details are available here: How to perform chroot with Linux namespaces?

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, the root mount is replaced and you work with an entirely separate tree of mounts. This involves some extra details, such as the pivot_root() system call. You probably don't need to know exactly how to do that. Some details are available here: How to perform chroot with Linux namespaces?

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount  # run a shell in a new mount namespace

# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp 

# exit  # exit the shell, and hence the mount namespace

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, the root mount is replaced and you work with an entirely separate tree of mounts. This involves some extra details, such as the pivot_root() system call. You probably don't need to know exactly how to do that. Some details are available here: How to perform chroot with Linux namespaces?

edited body
Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, pivot_root() is called to switch to a differentthe root filesystemmount is replaced and you work with an entirely separate tree of mounts. See This involves some extra details, such as the pivot_root() system call. You probably don't need to know exactly how to do that. Some details are available here: How to perform chroot with Linux namespaces?

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, pivot_root() is called to switch to a different root filesystem and an entirely separate tree of mounts. See How to perform chroot with Linux namespaces?

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, the root mount is replaced and you work with an entirely separate tree of mounts. This involves some extra details, such as the pivot_root() system call. You probably don't need to know exactly how to do that. Some details are available here: How to perform chroot with Linux namespaces?

edited body
Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

As per the name and documentation: mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /varmnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

YourYou can list your current set of mounts can be listed with the findmnt command.

In a full container, pivot_root() is called to switch to a different root filesystem and an entirely separate tree of mounts. See How to perform chroot with Linux namespaces?

As per the name and documentation: mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /var/
# ls /mnt/cp
cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

Your current mounts can be listed with the findmnt command.

In a full container, pivot_root() is called to switch to a different root filesystem and an entirely separate tree of mounts. See How to perform chroot with Linux namespaces?

mount namespaces differ in the arrangement of mounted filesystems.

This is very flexible, because mounts can be bind mounts of a sub-directory within a filesystem.

# unshare --mount
# mount --bind /usr/bin/ /mnt/
# ls /mnt/cp
/mnt/cp
# exit

# ls /mnt/cp
ls: cannot access '/mnt/cp': No such file or directory

You can list your current set of mounts with the findmnt command.

In a full container, pivot_root() is called to switch to a different root filesystem and an entirely separate tree of mounts. See How to perform chroot with Linux namespaces?

Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336
Loading