mount loop device?

Discussion in 'Kernel Questions' started by realshock, Nov 27, 2008.

  1. realshock

    realshock New Member

    This is my first post here and i hope you guys can help me out. I'm following instructions in this link and i'm hitting a major road bump. All i'm trying to do is to add BusLogic support to initrd image so kernel won't panic when i boot the Virtual Machine.

    Here is the error message that i'm getting:

    cd /boot
    gzip -dc initrd-2.4.20-8.img > /tmp/initrd.ext2
    mkdir /mnt/initrd
    mount -o loop /tmp/initrd.ext2 /mnt/initrd
    mount: you must specify the filesystem type
    How do i resolve the filesystem issue. I tried to add -t ext3 and -t ext2 and that didn't work. /dev/loop0 > 7 exist and lsmod lists loop as a module.
    Any ideas?

    Thanks in advance
  2. falko

    falko Super Moderator ISPConfig Developer

    I think you cannot mount a gzipped file.
  3. realshock

    realshock New Member

    Thank you falko for your response. Originally i was trying the mount -o loop command on the VMware machine using a live CD. I decided to give the mount command a shot on the physical machine and for no apparent reason It worked but it's mounting loop as read only:

    # mkdir /mnt/initrd
    # mount -0 loop /boot/initrd.img.2.6.24
    loop: module loaded
    # ls /mnt/initrd
    bin   dev2   keyscripts  linuxrc.conf  proc    scripts  usr
    bin2  devfs  lib         loadmodules   sbin    sys      var
    dev   etc    linuxrc     mnt           script  tmp
    #touch /mnt/initrd/test
    [COLOR="Red"]touch: cannot touch `/mnt/initrd/test': Read-only file system[/COLOR]
    /dev/hda1 on / type ext3 (rw,errors=remount-ro)
    tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    udev on /dev type tmpfs (rw,mode=0755)
    tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
    [COLOR="Red"]/boot/initrd.img-2.6.24-default1 on /mnt/initrd type cramfs (rw,loop=/dev/loop/0)[/COLOR]
    The reason for all i'm doing is to add lines into linuxrc to insert modules at boot time. I can not edit linuxrc when filesystem is mounted read only. Do you need to install an additional package for debian to make it read cramfs read-write?
    I checked on the file permissions for loop (i'm logged in root anyways):
    #ls -al /dev/loop*
    brw-rw---- 1 root disk 7, 0 2008-11-27 17:17 /dev/loop0
    brw-rw---- 1 root disk 7, 1 2008-11-27 17:17 /dev/loop1
    brw-rw---- 1 root disk 7, 2 2008-11-27 17:17 /dev/loop2
    brw-rw---- 1 root disk 7, 3 2008-11-27 17:17 /dev/loop3
    brw-rw---- 1 root disk 7, 4 2008-11-27 17:17 /dev/loop4
    brw-rw---- 1 root disk 7, 5 2008-11-27 17:17 /dev/loop5
    brw-rw---- 1 root disk 7, 6 2008-11-27 17:17 /dev/loop6
    brw-rw---- 1 root disk 7, 7 2008-11-27 17:17 /dev/loop7
    All i need to do as add two insmod lines to include BusLogic modules. I tried to use mkinitrd but in debian it seems that the command is very limited and doesn't allow inserting modules on the fly. the man page said that mkinitrd can insert modules into new image and i think lines needs to be added /etc/mkinitrd/modules and i'm not sure how since the file i have is almost empty except some commented lines.

    So two questions for you here:
    - Is there a way i can mount the loop file system on "true" read-write?
    - How do i use mkinitrd properly under debain? The documentation that i found was regarding redhat in which mkinitrd gives a lot more options it seems ... there are -f and -v options that don't exist with debian ( I updated mkinitrd-tool with apt-get to newest version)
    Last edited: Nov 28, 2008
  4. falko

    falko Super Moderator ISPConfig Developer

    You can build a new initrd with the needed modules as follows:

    Add your modules to /etc/modules, then run
    depmod 2.6.24
    mkinitrd -v -f /boot/initrd.img.2.6.24 2.6.24
  5. realshock

    realshock New Member

    problem revolved by creating ram disk image using initramfs instead of mkinitrd ... that added required scsi modules

    Thanks a lot for the help

Share This Page