Results 1 to 8 of 8

Thread: Ubuntu Mount Root Disk Image As A Loop Device Using Offset

  1. #1
    Senior Member vamsi's Avatar
    Join Date
    Nov 2009
    Location
    Bangalore / India
    Posts
    263
    Thanks
    138
    Thanked 14 Times in 12 Posts
    Rep Power
    5

    Wink Ubuntu Mount Root Disk Image As A Loop Device Using Offset

    Hi guys..I had installed Ubuntu from wubi installer on my friends .It was messed up, as it was on top of NTFS and due to frequent power cuts..now I have root.disk file ( 30 Gib)..
    Please tell me how to use that,,( mount ??) .. , btw..ubuntu will be highly stable if its installed on top of NTFS ..lol

    Thanks
    Last edited by vamsi; 17th July 2010 at 05:29 PM.
    shebangs

  2. #2
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    Default

    Do you want to access image file from Linux or Windows?
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  3. #3
    Senior Member vamsi's Avatar
    Join Date
    Nov 2009
    Location
    Bangalore / India
    Posts
    263
    Thanks
    138
    Thanked 14 Times in 12 Posts
    Rep Power
    5

    Default

    I want to access it from ubuntu..
    I am trying to mount it..but getting error

    root.disk is in /media/media/

    sudo mount -o loop /media/media/root.disk /vdisk
    mount: wrong fs type, bad option, bad superblock on /dev/loop1,
    missing codepage or helper program, or other error
    In some cases useful info is found in syslog - try
    dmesg | tail or so


    fdisk -l output




    I want to mount it in sdb

    Thanks
    Last edited by vamsi; 17th July 2010 at 05:43 PM.
    shebangs

  4. #4
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    Default

    Run file command on it and see what it reports back:
    Code:
    file /media/media/root.disk
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  5. #5
    Senior Member vamsi's Avatar
    Join Date
    Nov 2009
    Location
    Bangalore / India
    Posts
    263
    Thanks
    138
    Thanked 14 Times in 12 Posts
    Rep Power
    5

    Default

    Linux rev 1.0 ext4 filesystem data, UUID=f11da96c-c02a-48f9-b6ec-37fe3c0d4611 (needs journal recovery) (extents) (large files) (huge files)
    shebangs

  6. #6
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    Default

    Try
    Code:
    mkdir /vdisk
    mount -o loop -t ext4 /media/media/root.disk /vdisk
    If above failed than you need to get offset and mount it with the same:
    Code:
    fdisk -ul /media/media/root.disk
    Look out for sector number. If there are more partition you need to calculate offset and than mount it as follows:
    Code:
    mount -o loop,offset=XYZ  -t ext4 /media/media/root.disk /vdisk
    XYZ is offset and calculated as n * 512. Consider the follwoing example:

    Code:
    fdisk -ul image.img
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xf0000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048    31999999    15998976   82  Linux swap / Solaris
    /dev/sda2        32002046   976771071   472384513    5  Extended
    /dev/sda5        32002048   976771071   472384512   83  Linux
    In this case 2048 is starting offsent for /dev/sda1 and 32002048 is for /dev/sda5 so to mount /dev/sda5 you calculate it as 32002048 * 512 = 16385048576 and mount it as follows:
    Code:
    mount -o loop,offset=16385048576  -t ext4 /media/media/root.disk  /vdisk
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  7. The Following User Says Thank You to nixcraft For This Useful Post:

    vamsi (19th July 2010)

  8. #7
    Senior Member vamsi's Avatar
    Join Date
    Nov 2009
    Location
    Bangalore / India
    Posts
    263
    Thanks
    138
    Thanked 14 Times in 12 Posts
    Rep Power
    5

    Default

    Thanks it worked
    shebangs

  9. #8
    Junior Member
    Join Date
    Jan 2012
    Location
    /null
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Quote Originally Posted by nixcraft View Post
    Try
    Code:
    mkdir /vdisk mount -o loop -t ext4 /media/media/root.disk /vdisk
    If above failed than you need to get offset and mount it with the same:
    Code:
    fdisk -ul /media/media/root.disk
    Look out for sector number. If there are more partition you need to calculate offset and than mount it as follows:
    Code:
    mount -o loop,offset=XYZ  -t ext4 /media/media/root.disk /vdisk
    XYZ is offset and calculated as n * 512. Consider the follwoing example:
    Code:
    fdisk -ul image.img 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xf0000000     Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048    31999999    15998976   82  Linux swap / Solaris /dev/sda2        32002046   976771071   472384513    5  Extended /dev/sda5        32002048   976771071   472384512   83  Linux
    In this case 2048 is starting offsent for /dev/sda1 and 32002048 is for /dev/sda5 so to mount /dev/sda5 you calculate it as 32002048 * 512 = 16385048576 and mount it as follows:
    Code:
    mount -o loop,offset=16385048576  -t ext4 /media/media/root.disk  /vdisk
    Oh,thanks a lot for this

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to increase loop device
    By satimis in forum XEN
    Replies: 1
    Last Post: 24th October 2011, 11:53 AM
  2. [Solved] Mount NTFS iSCSI Image In Linux
    By Penny in forum Ubuntu / Debian
    Replies: 9
    Last Post: 14th July 2010, 10:54 AM
  3. Device busy when trying to mount
    By roy-arne in forum Ubuntu / Debian
    Replies: 0
    Last Post: 29th August 2008, 12:52 PM
  4. Mount iso image
    By saurabh_jsh in forum Linux hardware
    Replies: 1
    Last Post: 29th April 2008, 02:52 PM
  5. mount -o loop ....
    By PeterGib in forum Linux software
    Replies: 3
    Last Post: 17th August 2007, 06:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41