使い方:
losetup loopデバイス 情報をみる
losetup -a | --all 使用されている一覧を表示する
losetup -d | --detach
Usage:
losetup loop_device give info
losetup -a | --all list all used
losetup -d | --detach
LOSETUP(8) MAINTENANCE COMMANDS LOSETUP(8) 名前 losetup - loop デバイスの設定と制御を行う 書式 情報を取得する: losetup loop_device loop を削除する: losetup -d loop_device 使用されていない最初 loop デバイスの名前を表示する: losetup -f loop デバイスを設定する: losetup [{-e|-E} encryption] [-o offset] [-p pfd] {-f|loop_device} file 説明 losetup は loop デバイスを通常のファイルやブロックデバイスと接続/切断し たり、 loop デバイスへの問い合わせを行うために用いられる。引き数とし て loop_device が与えられた場合に限り、対応する loop デバイスの状態が表示 される。 暗号化 -E または -e オプションのいずれか 1 つにより、 (暗号化・復号化やその 他 の 目的で使う) 変換関数を指定することができる。使いたい暗号化機能を指定 する 2 つの仕組みがある。番号で指定する方法と名前で指定する方法である。 暗号化機能を番号で指定する場合、 Linux カーネルがその番号の暗号化機能を 知っていることを確認しておかなければならない。この暗号化機能は、たぶ ん カ ーネルへのパッチで提供される。常に提供されている標準的な番号は、 0 ( 暗号化なし) と 1 (XOR 暗号化) である。 cryptoloop モジュールがロード さ れ る と ( または組み込まれていると)、このモジュールは番号 18 を使う。 cryptoloop は任意の暗号化タイプの名前を受け取り、その暗号化を実行可能な モ ジュールを探す。 (よって、ユーザは -E オプションで 18 以外の番号を指 定するか、 -e オプションで名前を指定すればよい。) オプション -d 指定した loop デバイスを対応するファイルやデバイスから切り放す。 -E encryption_type 指定された番号のデータ暗号化機能を有効にする。 -e encryption_name 指定された名前のデータ暗号化機能を有効にする。 -f 使用されていない最初の loop デバイスを見つける。 file 引き数が指 定されている場合は、そのデバイスを使用する。指定されていない場合 は、loop デバイスの名前を表示する。 -o offset データの開始地点を指定したファイルやデバイスの offset バイトに移 動する。 -p num パスフレーズを端末からではなく、番号 num のファイルディスクリ プ タから読み込む。 返り値 losetup は 成 功すると 0 を返し、失敗すると 0 以外を返す。 losetup に loop デバイスの状態を表示させる場合は、デバイスが設定されていなければ 1 を、デバイスの状態を決定できなくするようなエラーが起った場合は 2 を返す 。 ファイル /dev/loop0, /dev/loop1, ... ループデバイス (major=7) 例 ローダブルモジュールを用いている場合は、まず以下のコマンドによってモ ジ ュールをロードする必要がある。 # insmod loop.o 暗号化モジュールも必要かも知れない。 # insmod des.o # insmod cryptoloop.o 以下の一連のコマンドは loop デバイスの使用例である。 # dd if=/dev/zero of=/file bs=1k count=100 # losetup -e des /dev/loop0 /file Password: Init (up to 16 hex digits): # mkfs -t ext2 /dev/loop0 100 # mount -t ext2 /dev/loop0 /mnt ... # umount /dev/loop0 # losetup -d /dev/loop0 ロ ーダブルモジュールを用いている場合は、以下のコマンドによってモジュー ルを削除することができる。 # rmmod loop 制限 DES 暗号化は非常に遅い。一方 XOR は非常に弱い。 Linux 2003-07-01 LOSETUP(8)
LOSETUP(8) MAINTENANCE COMMANDS LOSETUP(8) NAME losetup - set up and control loop devices SYNOPSIS Get info: losetup loopdev losetup -a losetup -j file [-o offset] Delete loop: losetup -d loopdev... Print name of first unused loop device: losetup -f Setup loop device: losetup [{-e|-E} encryption] [-o offset] [--sizelimit limit] [-p pfd] [-r] {-f[--show]|loopdev} file Resize loop device: losetup -c loopdev DESCRIPTION losetup is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device. If only the loopdev argument is given, the status of the corre- sponding loop device is shown. Encryption It is possible to specify transfer functions (for encryption/decryption or other purposes) using one of the -E and -e options. There are two mechanisms to specify the desired encryption: by number and by name. If an encryption is specified by number then one has to make sure that the Linux kernel knows about the encryption with that number, probably by patching the kernel. Standard numbers that are always present are 0 (no encryption) and 1 (XOR encryption). When the cryptoloop module is loaded (or compiled in), it uses number 18. This cryptoloop module will take the name of an arbitrary encryption type and find the module that knows how to perform that encryption. OPTIONS -a, --all show status of all loop devices -c, --set-capacity loopdev force loop driver to reread size of the file associated with the specified loop device -d, --detach loopdev... detach the file or device associated with the specified loop device(s) -e, -E, --encryption encryption_type enable data encryption with specified name or number -f, --find find the first unused loop device. If a file argument is present, use this device. Otherwise, print its name -h, --help print help -j, --associated file show status of all loop devices associated with given file -o, --offset offset the data start is moved offset bytes into the specified file or device --sizelimit limit the data end is set to no more than sizelimit bytes after the data start -p, --pass-fd num read the passphrase from file descriptor with number num instead of from the terminal -r, --read-only setup read-only loop device --show print device name if the -f option and a file argument are present. The short form of this option (-s) is deprecated. This short form could be in collision with Loop-AES implementation where the same option is used for --sizelimit. -v, --verbose verbose mode RETURN VALUE losetup returns 0 on success, nonzero on failure. When losetup displays the status of a loop device, it returns 1 if the device is not config- ured and 2 if an error occurred which prevented losetup from determin- ing the status of the device. FILES /dev/loop0, /dev/loop1, ... loop devices (major=7) EXAMPLE If you are using the loadable module you must have the module loaded first with the command # modprobe loop Maybe also encryption modules are needed. # modprobe des # modprobe cryptoloop The following commands can be used as an example of using the loop device. # dd if=/dev/zero of=/file bs=1k count=100 # losetup -e des /dev/loop0 /file Password: Init (up to 16 hex digits): # mkfs -t ext2 /dev/loop0 100 # mount -t ext2 /dev/loop0 /mnt ... # umount /dev/loop0 # losetup -d /dev/loop0 If you are using the loadable module you may remove the module with the command # rmmod loop RESTRICTION DES encryption is painfully slow. On the other hand, XOR is terribly weak. Cryptoloop is deprecated in favor of dm-crypt. For more details see cryptsetup(8). AVAILABILITY The losetup command is part of the util-linux-ng package and is avail- able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. Linux 2003-07-01 LOSETUP(8)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa