• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

mount partition image and edit it

Scheduled Pinned Locked Moved
General
4
7
5.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Rico
    last edited by Feb 15, 2016, 5:01 PM

    Hello,
    Following this topuic which is quite old : Mount saved image and edit it?

    I’m looking for a way to mount a fog partition image. I tried many things

    Uncompress partition image :
    [root@fog images]# cd dev/srvtoip_dev/
    [root@fog srvtoip_dev]# pwd
    /images/dev/srvtoip_dev
    [root@fog srvtoip_dev]# file d1p1.img
    d1p1.img: gzip compressed data, from Unix, last modified: Wed Feb 10 10:43:58 2016, max compression

    mount image :
    [root@fog srvtoip_dev]# losetup /dev/loop0 d1p1.img
    losetup: d1p1.img: warning: file does not fit into a 512-byte sector the end of the file will be ignored.

    I’ve tried many combinations with losetup / mount / gunzip…

    Can somebody help me with that ?

    Regards,
    Cédric

    1 Reply Last reply Reply Quote 0
    • C
      cml Moderator
      last edited by cml Feb 16, 2016, 5:37 AM Feb 15, 2016, 5:15 PM

      Give this a try: https://forums.fogproject.org/topic/5264/peek-into-img-files/4

      @cml said:

      It seems like it would be easier to just restore the image to a client, but I had to find a way.

      All of this is done on Debian 7 and like Wayne I would not advise you doing this on your production server.

      Breakdown:
      Install ntfs-3g, partclone, and pigz
      Decompress image and restore to a file
      Mount image

      apt-get install ntfs-3g partclone pigz
      cd /images/SecurityE420s/
      cat d1p2.img | pigz -d -c | partclone.restore -C -s - -O d1p2_extracted.img
      mount -t ntfs-3g d1p2_extracted.img /mnt
      
      ls -lah /mnt
      total 6.9G
      drwxrwxrwx  1 root root 4.0K Aug 27  2014 .
      drwxr-xr-x 28 root root 4.0K Jun 18 17:15 ..
      lrwxrwxrwx  2 root root   60 Jul 14  2009 Documents and Settings -> /mnt/Users
      -rwxrwxrwx  1 root root 9.5K Aug 28  2014 fog.log
      -rwxrwxrwx  1 root root 3.0G Aug 28  2014 hiberfil.sys
      drwxrwxrwx  1 root root    0 Aug 27  2014 Intel
      drwxrwxrwx  1 root root    0 Jun 11  2014 MSOCache
      -rwxrwxrwx  1 root root 4.0G Aug 28  2014 pagefile.sys
      drwxrwxrwx  1 root root    0 Jul 13  2009 PerfLogs
      drwxrwxrwx  1 root root 4.0K Aug 28  2014 ProgramData
      drwxrwxrwx  1 root root 8.0K Aug 27  2014 Program Files
      drwxrwxrwx  1 root root 8.0K Aug 27  2014 Program Files (x86)
      -rwxrwxrwx  1 root root 3.1K Aug 28  2014 QcOSD.txt
      drwxrwxrwx  1 root root    0 Aug 26  2014 $Recycle.Bin
      drwxrwxrwx  1 root root 4.0K Jun 11  2014 System Volume Information
      drwxrwxrwx  1 root root 4.0K Nov 20  2010 Users
      drwxrwxrwx  1 root root  40K Aug 28  2014 Windows
      
      
      
      R 1 Reply Last reply Feb 18, 2016, 1:11 PM Reply Quote 2
      • S
        Sebastian Roth Moderator
        last edited by Feb 16, 2016, 6:39 AM

        @cml Great answer!! Just want to add that you better be careful not to overwrite d1p3.img if this exists in your image directory… Maybe it’s more clear to name the extracted file d1p2_extracted.img

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        C 1 Reply Last reply Feb 16, 2016, 11:37 AM Reply Quote 1
        • C
          cml Moderator @Sebastian Roth
          last edited by Feb 16, 2016, 11:37 AM

          @Sebastian-Roth

          Good catch, the post has been modified.

          1 Reply Last reply Reply Quote 2
          • T
            Tom Elliott
            last edited by Feb 16, 2016, 2:44 PM

            Mind you, @cml’s advice is accurate, but if you need to edit the image, you already have to perform a “restore” regardless of how it’s to be done.

            If you extract the data and place it in a file, or you’re running a download task, you have to perform the same actions as a download task.

            If you know the same things have to be done every time, you can also create a postdownload script to mount the partition and perform any cursory actions as needed before the task completes. This way, I think, is more appropriate as you’re not using disk space on your FOG Server, as the mounted point is directly off the drive of the system that was just restored. You’re also not leaving the entirety of the image in a potential state of disarray. While you could screw up the postdownload script, you can comment it to stop actions from occurring. Editing the image from a file, then re-uploading that file to the main would make that change permanent for ALL hosts that restore that image.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 1
            • R
              Rico @cml
              last edited by Rico Feb 18, 2016, 7:18 AM Feb 18, 2016, 1:11 PM

              @cml said:

              Give this a try: https://forums.fogproject.org/topic/5264/peek-into-img-files/4

              hello cml

              I’ve tried, but it does not seem to work.
              here’s the things I’ve done :

              [root@fog ]# file d1p1.img 
              d1p1.img: gzip compressed data, from Unix, last modified: Wed Feb 17 15:38:56 2016, max compression
              
              [root@fog ]# cat d1p1.img | pigz -d -c | partclone.restore -C -s - -O d1p1_extracted.img
              Partclone v0.2.71 http://partclone.org
              Démarrage restauration image (-) vers périphérique (d1p1_extracted.img)
              device (d1p1_extracted.img) is mounted at 
              error exit
              Partclone fail, please check /var/log/partclone.log !
              

              I have to precise that “d1p1_extracted.img” is not mounted anywhere. I really don’t understand this error.


              Another thing I’ve done, I’ve tried to extract the image :

              [root@fog ]# cat d1p1.img | gzip -d -c > d1p1_extract.img
              [root@fog SrvToip_fpbx_2T0]# file d1p1_extract.img 
              d1p1_extract.img: data
              
              [root@fog ]# losetup /dev/loop0 d1p1_extract.img 
              losetup: d1p1_extract.img: warning: file does not fit into a 512-byte sector the end of the file will be ignored.
              

              Any tip ?
              Regards,
              Cédric

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Sebastian Roth Feb 18, 2016, 7:43 AM Feb 18, 2016, 1:40 PM

                @Rico Maybe this helps: https://bbs.archlinux.org/viewtopic.php?id=179929

                Seams like some kind of weird partclone thing… You might need to create an empty output file first.

                As well you want to read this: https://sourceforge.net/p/clonezilla/discussion/Clonezilla_live/thread/4db4b2bd/ (partclone.restore seams to be deprecated and you should use partclone.<fstype>)

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  3/7
                  Last post

                166

                Online

                12.1k

                Users

                17.3k

                Topics

                155.3k

                Posts
                Copyright © 2012-2024 FOG Project