• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Extend allowed number of loopback devices

by admin

A loopback device is used to access filesystems that are not associated with a block device (Hard Disk drives and CD-ROM drives are examples of block devices). By default there are 8 devices available, named /dev/loop0 through to /dev/loop7.

Extending allowed number of loopbac devices

For CentOS/RHEL 5

To set a limit of “N” loopback devices edit the /etc/modules.conf file, and add the below line to it.

# vi /etc/modules.conf
options loop max_loop=N

When the loop module is loaded or when the system is rebooted, the new setting will take effect. There is an absolute maximum of 256 devices in CentOS/RHEL 5. So you can not exceed the loopback devices beyond that.

For CentOS/RHEL 6

For RHEL6, which uses loopback support directly as part of the kernel, the kernel option ‘max_loop’ can be used. This option can be configured in /etc/grub.conf and is used after a reboot of the system. To set the limit to “N” devices, edit the /etc/grub.conf file, and add max_loop=64 at the end of kernel line.

# vi /etc/grub.conf
...
kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/root rhgb quiet max_loop=64
initrd /initramfs-2.6.32-131.0.15.el6.x86_64.img

Creating additional loopback device ‘nodes’

Apart from the above 2 ways, you can always create loopback devices using the “mknod” command. Follow the steps outlined belwo to create new loopback devices on the fly.

1. List the existing loopback devices.

# ls -l /dev/loop*
brw-r-----  1 root disk 7,  0 Mar 24 17:49 /dev/loop0
brw-r-----  1 root disk 7,  1 Mar 24 17:49 /dev/loop1
brw-r-----  1 root disk 7,  2 Mar 24 17:49 /dev/loop2
brw-r-----  1 root disk 7,  3 Mar 24 17:49 /dev/loop3
brw-r-----  1 root disk 7,  4 Mar 24 17:49 /dev/loop4
brw-r-----  1 root disk 7,  5 Mar 24 17:49 /dev/loop5
brw-r-----  1 root disk 7,  6 Mar 24 17:49 /dev/loop6
brw-r-----  1 root disk 7,  7 Mar 24 17:49 /dev/loop7

2. Create a new device node with the mknod command:

# mknod -m660 /dev/loop8 b 7 8

3. Verify the device node has been created:

# ls -lrt /dev/loop8
brw-rw----. 1 root root 7, 8 Apr  1 01:45 /dev/loop8

4. Set the ownership correctly and verify the ownership:

# chown root.disk /dev/loop8
# ls -lrt /dev/loop8
brw-rw----. 1 root disk 7, 8 Apr  1 01:45 /dev/loop8
How to create virtual block device (loop device/filesystem) in Linux
How to create partitions inside loopback device

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. pw-play Command Examples in Linux
  2. bluetoothd Command Examples in Linux
  3. equery Command Examples in Gentoo Linux
  4. kexec Command Examples in Linux
  5. extrace: command not found
  6. kwriteconfig5 Command Examples in Linux
  7. finch Command Examples in Linux
  8. ipcmk: command not found
  9. journalctl: command not found
  10. How to Mount Guest Qcow2 Virtual disk Image containing LVM on KVM Host Machine

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright