最終更新:2023-12-05 (火) 05:42:50 (81d)  

losetup
Top / losetup

loop デバイスの設定と制御を行う

パラメータ

  • -c, --set-capacity loopdevforce loop driver to reread size of the file associated with the specified loop device

help

  • Usage:
     losetup [options] [<loopdev>]
     losetup [options] -f | <loopdev> <file>
    
    Set up and control loop devices.
    
    Options:
     -a, --all                     list all used devices
     -d, --detach <loopdev>...     detach one or more devices
     -D, --detach-all              detach all used devices
     -f, --find                    find first unused device
     -c, --set-capacity <loopdev>  resize the device
     -j, --associated <file>       list all devices associated with <file>
     -L, --nooverlap               avoid possible conflict between devices
    
     -o, --offset <num>            start at offset <num> into file
         --sizelimit <num>         device is limited to <num> bytes of the file
     -b  --sector-size <num>       set the logical sector size to <num>
     -P, --partscan                create a partitioned loop device
     -r, --read-only               set up a read-only loop device
         --direct-io[=<on|off>]    open backing file with O_DIRECT
         --show                    print device name after setup (with -f)
     -v, --verbose                 verbose mode
    
     -J, --json                    use JSON --list output format
     -l, --list                    list info about all or specified (default)
     -n, --noheadings              don't print headings for --list output
     -O, --output <cols>           specify columns to output for --list
         --output-all              output all columns
         --raw                     use raw --list output format
    
     -h, --help                    display this help
     -V, --version                 display version
    
    Available output columns:
             NAME  loop device name
        AUTOCLEAR  autoclear flag set
        BACK-FILE  device backing file
         BACK-INO  backing file inode number
     BACK-MAJ:MIN  backing file major:minor device number
          MAJ:MIN  loop device major:minor number
           OFFSET  offset from the beginning
         PARTSCAN  partscan flag set
               RO  read-only device
        SIZELIMIT  size limit of the file in bytes
              DIO  access backing file with direct-io
          LOG-SEC  logical sector size in bytes
    
    For more details see losetup(8).
    

Ubuntu 20.04

  • $ losetup
    NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                        DIO LOG-SEC
    /dev/loop1         0      0         1  1 /var/lib/snapd/snaps/core20_1828.snap              0     512
    /dev/loop4         0      0         1  1 /var/lib/snapd/snaps/gnome-3-38-2004_119.snap      0     512
    /dev/loop2         0      0         1  1 /var/lib/snapd/snaps/gtk-common-themes_1535.snap   0     512
    /dev/loop0         0      0         1  1 /var/lib/snapd/snaps/bare_5.snap                   0     512
    /dev/loop5         0      0         1  1 /var/lib/snapd/snaps/snapd_18357.snap              0     512
    /dev/loop3         0      0         1  1 /var/lib/snapd/snaps/snap-store_638.snap           0     512

関連