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

 

Was dit antwoord nuttig? 0 gebruikers vonden dit artikel nuttig (0 Stemmen)