Skip to contentSkip to conversation

losetup --list

DISCUSSION Karel Zak 1 participant 1 message Nov 12, 2012 Util-Linux package

lore
Share & tools
lore

Karel Zak

author maintainer
#0 lore raw

Hi,

I have applied Ondrej's patch to support a new losetup output format. The output uses tt.c, so it's compatible with our others utils (lscpu, lsblk, prlimit, ...).

Now losetup prints all loopdevs in the new format if no other option is specified.

   $ losetup
   NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
   /dev/loop0         0      0         0  0 /home/fs-images/swap.img
   /dev/loop1         0    100         0  0 /home/fs-images/disk.img
   $ losetup -O +MAJ:MIN
   NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                 MAJ:MIN
   /dev/loop0         0      0         0  0 /home/fs-images/swap.img    7:0  
   /dev/loop1         0    100         0  0 /home/fs-images/disk.img    7:1 

(we read all important information from /sys, so it's usable for
non-root users too.)

The change is backwardly compatible, -j or -a without --list returns the original format. The old format is marked as deprecated now.

Thanks to Ondrej!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com