Re: EXT2-fs: unable to read superblock (loopback)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2003-05-22 at 19:36, David Wuertele wrote:
> I have an EXT2 filesystem on a file that can be read loopback
> sometimes, but not others!
> 
> I have a box with a root fs on ext2, and another (small) root fs on
> msdos.  When I boot my box onto the ext2 partition, and run the
> following:
> 
> # mount /dev/ide/host0/bus0/target0/lun0/p1 /mnt/msdos
> # losetup /dev/loop/0 /mnt/msdos/ext2image.bin
> # mount /dev/loop/0 /mnt/e2fs
> 
> ...this results in the ext2 filesystem image being mounted fine.  I
> can chdir into /mnt/e2fs and read and write fine.
> 
> But when I boot into the msdos partition, and execute the following:
> 
>   ffd = open ("/mnt/msdos/ext2image.bin", O_RDWR);
>   fd = open ("/dev/loop/0", O_RDWR);
>   memset (&loopinfo, 0, sizeof(loopinfo));
>   strncpy (loopinfo.lo_name, "/mnt/msdos/ext2image.bin", LO_NAME_SIZE);
>   namesize = strlen ("/mnt/msdos/ext2image.bin");
>   loopinfo.lo_name[namesize];
>   loopinfo.lo_offset = 0;
>   loopinfo.lo_encrypt_type = LO_CRYPT_NONE;
>   loopinfo.lo_encrypt_key_size = 0;
>   ioctl (fd, LOOP_SET_FD, ffd);
>   ioctl (fd, LOOP_SET_STATUS, &loopinfo);
>   close (fd);
>   close (ffd);
>   mount ("/dev/loop/0", "/mnt", "ext2", 0, NULL);
>   chdir ("/mnt");
> 
> This results in the following kernel error:
> 
>   EXT2-fs: unable to read superblock
> 
> How is this possible?  Why would the exact same file mounted on the
> exact same loopback device have a readable superblock in the first
> instance, but an unreadable one in the second?
> 
> The only difference is which root fs I booted into.  The loopback
> commands should be the same.  Any clues?


Are you checking those return values?  It that /mnt/msdos/ext2image.bin
path even value when you root FD is the msdos partition?


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux