How to install VM from ISO?

mount: only root can use «—options» option

  1. 1.0 1.1 Artemiy I. Pavlov, Marco Cecchetti. The SquashFS tools exposed, The Linux Documentation Project, July 24, 2008. Retrieved on April 8, 2015
  • Aufs — an advanced multi-layered unification filesystem.
  • OverlayFS — an in-kernel attempt at providing union file system capabilities on Linux.
  • Wikipedia:UnionFS — The original union filesystem.

The command is part of the util-linux package. In Gentoo Linux, sys-apps/util-linux is part of the system set and is installed on all Gentoo systems by default.

If for some strange and unordinary reason it is missing it can be re-installed by running a simple command (always use the --oneshot option). This can also be used after changing USE flags:

root emerge --ask --oneshot sys-apps/util-linux

  • 日本語

SquashFS is an open source, read only, extremely compressible filesystem. Like other filesystems, SquashFS is capable of de-duplicating the data passed to it, which helps it compress data further. Although not fully necessary to operate correctly, SquashFS is typically paired with some kind of union filesystem when used for Live media (LiveUSBs and LiveCDs).

  • Mounting partitions in the Security Handbook
  • /etc/fstab — a configuration file that defines how and where the main filesystems are to be mounted, especially at boot time.
  • Removable media — any media that is easily removed from a system.
  • AutoFS — a program that uses the Linux kernel automounter to automatically mount filesystems on demand.
  • Udevil — a small auto-mount utility created to be a «a hassle-free replacement for udisks
  • CurlFtpFS — allows for mounting an FTP folder as a regular directory to the local directory tree.
  • USB/Guide — Mounting a USB Mass Storage device
  • UUIDs and labels

Mounting removable media

See the relevant section in the Removable media article.

//server/folder /home/larry/winmount cifs noauto,user 0 0
This program is not installed setuid root -  "user" CIFS mounts not supported.

The solution is to use sudo mount /home/larry/winmount in combination with a corresponding entry in to allow passwordless mounting.

Be sure to understand the sudo configuration before editing the file!

larry    ALL = NOPASSWD: /bin/mount  /home/larry/winmount/, /bin/mount  /home/larry/winmount
larry    ALL = NOPASSWD: /bin/umount /home/larry/winmount/, /bin/umount /home/larry/winmount

I prepared pool, volume and installation ISO, want to install headless VM using console. Here’s my command:

virt-install -n myvm -r 2048 --disk path=/home/username/virtpools/mydisk.img
--location /opt/images/CentOS-7-x86_64-Everything-1611.iso
--graphics=none --extra-args="console=tty0 console=ttyS0,115200n8" 
--noautoconsole --network=bridge:virbr0
--disk path=$HOME/virtpools/mydisk.img,format=qcow2
Starting install...
mount: only root can use "--options" option
ERROR    Invalid install location: Mounting location '/opt/images/CentOS-7-x86_64-Everything-1611.iso' failed
Domain installation does not appear to have been successful.

My /opt /opt/images and ISO in the last directory are both readable and writable by world.

EDIT: When I(without sudo) specify URL in —location like, it creates VM, so that I could login into it using virsh console vm

Решил попробовать подключить удаленные файловые системы при помощи systemd .mount-модулей. По пользователям, а не для системы глобально.

Подключение из командной строки работает без проблем:

sshfs iron.burato:/ ~/iron

Файловая система подключается, можно работать.
В ~/.ssh/config

Host iron.burato
    IdentityFile ~/.ssh/Keys/iron.burato
    User burato

systemctl --user start home-burato-iron.mount
mount[17611]: mount: only root can use "--types" option

Попробовал добавить в .mount:

Дополнительно:  BSOD подкрался незаметно… 25 очень неожиданных экранов смерти

systemctl --user daemon-reload
mount[20509]: mount: only root can use "--options" option

Получается подключаться systemd .mount-модулями можно только от суперпользователя? Просто была идея наделать таких файлов .mount для разных удаленных sshfs, webdav и nfs.

ОС Arch Linux, но systemd вроде как везде одинаков.

Here are the contents of my fstab:

# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
proc            /proc           proc    defaults        0       0
# / was on /dev/mapper/minicc-root during installation
UUID=1a69f02a-a049-4411-8c57-ff4ebd8bb933 /               ext3    relatime,errors=remount-ro 0       1
# /boot was on /dev/sda5 during installation
UUID=038498fe-1267-44c4-8788-e1354d71faf5 /boot           ext2    relatime        0       2
# swap was on /dev/mapper/minicc-swap_1 during installation
UUID=0bb583aa-84a8-43ef-98c4-c6cb25d20715 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/scd0       /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
/dev/sdb1   /mnt/sdcard auto    auto,user,rw,exec   0   0
$ mount /dev/sdb1 /mnt/sdcard

/bin/mount is owned by root and is in the root group and has 4755 permissions.
/bin/umount is owned by root and is in the root group and has 4755 permissions.
/mnt/sdcard is owned by me and is in one of my groups and has 0755 permissions.

My mount command works fine if I use sudo, but I need to be able to do this without sudo (need to be able to do it from a PHP script using shell_exec). Any suggestions?

Enabling SquashFS 4.0 support

File systems  --->
   [*] Miscellaneous filesystems  --->
      [*]   SquashFS 4.0 - Squashed file system support

Optional SquashFS support

Enabling optional features of SquashFS

File systems  --->
   [*] Miscellaneous filesystems  --->
         File decompression options (Decompress file data into an intermediate buffer)  --->
         Decompressor parallelisation options (Single threaded compression)  --->
      [*]     Squashfs XATTR support
      [*]     Include support for ZLIB compressed file systems
      [*]     Include support for LZ4 compressed file systems
      [*]     Include support for LZO compressed file systems
      [*]     Include support for XZ compressed file systems
      [*]     Use 4K device block size?
      [*]     Additional option for memory-constrained systems
      (3)       Number of fragments cached

Like most filesystems in Linux, the SquashFS filesystem tools come in a separate package. This package is called sys-fs/squashfs-tools. Set the desired support for the package by adjusting USE flags accordingly.

USE flags for

Tools to create and extract Squashfs filesystems

After setting flags as desired, update the system so the changes take effect:

root emerge --ask --changed-use --deep sys-fs/squashfs-tools

Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /home/larry/home.squashfs, block size 131072.
[=========================================================================|] 4/4 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments, compressed xattrs
        duplicates are removed
Filesystem size 0.82 Kbytes (0.00 Mbytes)
        58.79% of uncompressed filesystem size (1.39 Kbytes)
Inode table size 104 bytes (0.10 Kbytes)
        46.02% of uncompressed inode table size (226 bytes)
Directory table size 96 bytes (0.09 Kbytes)
        77.42% of uncompressed directory table size (124 bytes)
Number of duplicate files found 1
Number of inodes 7
Number of files 5
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2
Number of ids (unique uids + gids) 1
Number of uids 1
        larry (1001)
Number of gids 1
        larry (1001)

Дополнительно:  Почему не включается экран на ноутбуке: анализ причин и методы исправления

Notice the command provides an excellent summary of what went into the newly created file. Information such as filesystem size, inode table, directory table, number of duplicate files, UIDs, and GIDs are easily readable. This information can be very helpful when attempting to gather specific information from the filesystem.

To mount a SquashFS, use the command’s -o loop option with escalated privileges:

If the command fails, see the related entry in the troubleshooting section below.

Now all the files that are included in are available under the mount point. List the files in the directory using the -la options to see all the files:

total 3
drwxr-xr-x 3 larry larry 125 Mar 31 13:51 .
drwxr-xr-x 1 larry larry 130 Mar 31 13:52 ..
-rw------- 1 larry larry  10 Mar 31 13:49 .bash_history
-rw-r--r-- 1 larry larry 127 Mar 24 13:19 .bash_logout
-rw-r--r-- 1 larry larry 193 Mar 24 13:19 .bash_profile
-rw-r--r-- 1 larry larry 551 Mar 24 13:19 .bashrc
-rw-r--r-- 1 larry larry   0 Mar 31 13:51 home.squashfs
drwx------ 2 larry larry   3 Oct 23 06:52 .ssh

To unmount the filesystem, use the command with escalated privileges:

SquashFS files can be extracted using . Supposing the directory and the file have been previously created in the steps above:

  • If a filesystem target is not specified ( is the target in the example above) will create a folder called in the current directory and extract the files there.[1]
  • If a directory exists previous to the command being run, then the -d <directory> and -f options must be used in order to force SquashFS extraction to the existing directory [1]
  • When extracting to a new directory, the -f option is not needed.

can be used to extract a specific file in the SquashFS. Again, presuming the file has been previously created in the steps above, the file can be extracted to the directory:

Parallel unsquashfs: Using 4 processors
1 inodes (1 blocks) to write

[===========================|] 1/1 100%

created 1 files
created 1 directories
created 0 symlinks
created 0 devices
created 0 fifos

View the extract file using the command:

total 4
drwxr-xr-x 1 larry larry  14 Mar 31 13:51 .
drwxr-xr-x 1 larry larry 156 Mar 31 14:32 ..
-rw-r--r-- 1 larry larry 551 Mar 24 13:19 .bashrc

root mount --help

 mount [-lhV]
 mount -a [options]
 mount [options] [--source] <source> | [--target] <directory>
 mount [options] <source> <directory>
 mount <operation> <mountpoint> [<target>]
Mount a filesystem.
 -a, --all               mount all filesystems mentioned in fstab
 -c, --no-canonicalize   don't canonicalize paths
 -f, --fake              dry run; skip the mount(2) syscall
 -F, --fork              fork off for each device (use with -a)
 -T, --fstab <path>      alternative file to /etc/fstab
 -i, --internal-only     don't call the mount.<type> helpers
 -l, --show-labels       show also filesystem labels
 -m, --mkdir[=<mode>]    alias to '-o X-mount.mkdir[=<mode>]'
 -n, --no-mtab           don't write to /etc/mtab
     --options-mode <mode>
                         what to do with options loaded from fstab
     --options-source <source>
                         mount options source
                         force use of options from fstab/mtab
 -o, --options <list>    comma-separated list of mount options
 -O, --test-opts <list>  limit the set of filesystems (use with -a)
 -r, --read-only         mount the filesystem read-only (same as -o ro)
 -t, --types <list>      limit the set of filesystem types
     --source <src>      explicitly specifies source (path, label, uuid)
     --target <target>   explicitly specifies mountpoint
     --target-prefix <path>
                         specifies path used for all mountpoints
 -v, --verbose           say what is being done
 -w, --rw, --read-write  mount the filesystem read-write (default)
 -N, --namespace <ns>    perform mount in another namespace
 -h, --help              display this help
 -V, --version           display version
 -L, --label <label>     synonym for LABEL=<label>
 -U, --uuid <uuid>       synonym for UUID=<uuid>
 LABEL=<label>           specifies device by filesystem label
 UUID=<uuid>             specifies device by filesystem UUID
 PARTLABEL=<label>       specifies device by partition label
 PARTUUID=<uuid>         specifies device by partition UUID
 ID=<id>                 specifies device by udev hardware ID
 <device>                specifies device by path
 <directory>             mountpoint for bind mounts (see --bind/rbind)
 <file>                  regular file for loopdev setup
 -B, --bind              mount a subtree somewhere else (same as -o bind)
 -M, --move              move a subtree to some other place
 -R, --rbind             mount a subtree and all submounts somewhere else
 --make-shared           mark a subtree as shared
 --make-slave            mark a subtree as slave
 --make-private          mark a subtree as private
 --make-unbindable       mark a subtree as unbindable
 --make-rshared          recursively mark a whole subtree as shared
 --make-rslave           recursively mark a whole subtree as slave
 --make-rprivate         recursively mark a whole subtree as private
 --make-runbindable      recursively mark a whole subtree as unbindable
For more details see mount(8).

Дополнительно:  Database.Guide

Show mounted filesystems by running the mount command with no arguments or options:

root mount <DEVICE> <DIRECTORY>

For further details, see man 8 mount.

root mkdir /media/usb

root mount /dev/sdb1 /media/usb

A mount from fstab may by mounted by providing just the mountpoint, or device name, for example:

Unmount a filesystem

To unmount a filesystem, the device file or the mount point can be specified:

 umount [-hV]
 umount -a [options]
 umount [options] <source> | <directory>
Unmount filesystems.
 -a, --all               unmount all filesystems
 -A, --all-targets       unmount all mountpoints for the given device in the
                           current namespace
 -c, --no-canonicalize   don't canonicalize paths
 -d, --detach-loop       if mounted loop device, also free this loop device
     --fake              dry run; skip the umount(2) syscall
 -f, --force             force unmount (in case of an unreachable NFS system)
 -i, --internal-only     don't call the umount.<type> helpers
 -n, --no-mtab           don't write to /etc/mtab
 -l, --lazy              detach the filesystem now, clean up things later
 -O, --test-opts <list>  limit the set of filesystems (use with -a)
 -R, --recursive         recursively unmount a target with all its children
 -r, --read-only         in case unmounting fails, try to remount read-only
 -t, --types <list>      limit the set of filesystem types
 -v, --verbose           say what is being done
 -q, --quiet             suppress 'not mounted' error messages
 -N, --namespace <ns>    perform umount in another namespace
 -h, --help              display this help
 -V, --version           display version
For more details see umount(8).

Sometimes, mounting a filesystem requires special options:

The filesystem being used must support the mount option being passed. Many options are common, but some are filesystem specific.

It is advised to always consult man pages of both and the particular filesystem (for example or ).

Mount options of already-mounted filesystems can be changed using remount option. For example, setting a filesystem on to be mounted as read-write can be achieved using:

root mount -o remount,rw /dev/foo /dir

Оцените статью
Master Hi-technology
Добавить комментарий