Results 1 to 6 of 6

Thread: Is it possible to resize/copy persistant disk image?

  1. #1
    Member registered user
    Join Date
    Mar 2005
    Posts
    35

    Is it possible to resize/copy persistant disk image?

    Ok, here's the deal:
    I have a persistant disk image with programs I've installed/upgraded and my music etc on.
    I want to move the image to an external hard drive.
    The trouble is, the external drive is too small for the image (although not the contents of the image).

    So, to my question:
    Is it possibly to resize a persistant disk image?

    And my second question:
    Is it possible to copy the contents of one image to another? I've tried creating an image on the external drive, then mounting both images and copying the contents of the old one to the new one, but it just yells at me saying it can't create folders. Is there anything I can do with permissions to make this possible?

    Thanks,
    Mark

  2. #2
    Member registered user
    Join Date
    Mar 2005
    Posts
    35
    Anyone? Even if it's not possible I'd like to know so I can get on finding an alternative solution.

    Mark

  3. #3
    Senior Member registered user
    Join Date
    Dec 2003
    Location
    Salt Lake City, UT, U.S.A.
    Posts
    1,338
    mark.johnson,

    I dont have a clue, maybe some ideas, but, only theoretical...

    Can you create "another" image, this one being smaller, and then "copy" the contents of one, into the other ? ( and will the image still retain its contents properly? )

    Does the system "keep" these image settings somewhere, and thus, these settings can be "tweaked" with resizing software ?

    I cant imagine this not being something someone else hasnt come up against, and possibly resolved... Have you tried a "Search" for any relevant information? Possibly a google for something related, or within this site?

    I've never worked with image files, not of the file system/disk type, so, I dont have any answers, mostly, more questions... But, I tried as best as I can here
    Ms. Cuddles

  4. #4
    Member registered user
    Join Date
    Mar 2005
    Posts
    35
    Hi Cuddles,
    I've tried to create a smaller image and copy the contents across, but it tells me it's unable to create anything in the new image.

    Thanks for your help anyway, I'll try searching again

    mark

  5. #5
    Member registered user
    Join Date
    Mar 2005
    Posts
    35
    I've solved the problem. So if you need to downsize a persistent image, here's how it's done:

    You will need:
    Your larger disk image
    Enough space for the smaller disk image

    Firstly, boot knoppix without any persistant images/home dir of any sort.
    Create the new, smaller disk image (doesn't matter if it's on the wrong device, you can move it later)
    As root (or using File Manager - Super User Mode) create mnt/oldimg and mnt/newimg
    Ensure that you have read/write access to both of these directories
    On the desktop, there should be icons for the devices with your 2 knoppix.img files on. Right click the icons, select Properties, and on the device tab, uncheck "Read Only". When you have done this for both devices, click the icons to mount them.
    As root, ensure you have read/write access to both knoppix.img files.
    Now, mount the images using
    Code:
    mount -o loop mnt/[device]/knoppix.img mnt/oldimg
    mount -o loop mnt/[otherdevice]/knoppix.img mnt/newimg
    Open /mnt/newimg and /mnt/oldimg in File Manager - Super User Mode
    Copy all the folders from /mnt/oldimg to /mnt/newimg EXCEPT FOR /dev AND /lost+found
    When the copy process finishes, change the permissions of the knoppix.img files back, and you're done!

    Mark

  6. #6
    Senior Member registered user
    Join Date
    Feb 2005
    Location
    Saint Louis, MO, USA
    Posts
    376

    Re: Is it possible to resize/copy persistant disk image?

    Quote Originally Posted by mark.johnson
    Is it possibly to resize a persistant disk image?
    Yes. You can resize (shrink and grow) a persistent disk image (PDI) using a combination of dd, e2fsck, and resize2fs. For example, say you have a 200 MB knoppix.img file with only 100 MB of content on /dev/hda1. You want to shrink the image to 110 MB so that the image still has a little bit of room. Here's how:
    • boot: knoppix -b
      mkdir /mnt/hda1
      mount /dev/hda1 /mnt/hda1
      cd /mnt/hda1
      e2fsck -pf knoppix.img
      resize2fs knoppix.img 102M
      dd of=knoppix.img bs=1 count=0 seek=110M
      e2fsck -pf knoppix.50.img
      resize2fs -f knoppix.img
      e2fsck -pf knoppix.50.img
      cd
      umount /mnt/hda1
      rmdir /mnt/hda1
      exit
    To expand by 10 MB:
    • boot: knoppix -b
      mkdir /mnt/hda1
      mount /dev/hda1 /mnt/hda1
      cd /mnt/hda1
      dd if=/dev/zero bs=1M count=10 >> knoppix.img
      e2fsck -pf knoppix.img
      resize2fs -f knoppix.img
      cd
      umount /mnt/hda1
      rmdir /mnt/hda1
      exit

    The -b option to Knoppix boots linux into "emergency mode" which is before any PDI is mounted. This allows you to boot linux, make changes to the image (or anything else), and then continue booting with the new image.

    For more details, see:
    http://lists.firepipe.net/pipermail/...ay/002604.html
    http://lists.firepipe.net/pipermail/...ay/002633.html

    Note: Be very careful with the dd comand. One slip up and your data is gone. You may want to make a backup of any images just in case.

    Quote Originally Posted by mark.johnson
    Is it possible to copy the contents of one image to another?
    Yes. Mount both images via the loopback device and then copy. For example, say you want to copy file "foo" from knoppix.01.img to knoppix.02.img:
    • boot: knoppix -b
      mkdir /mnt/hda1 /mnt/img.1 /mnt/img.2
      mount /dev/hda1 /mnt/hda1
      cd /mnt/hda1
      mount -o loop knoppix.01.img /mnt/img.1
      mount -o loop knoppix.02.img /mnt/img.2
      cp -a /mnt/img.1/home/knoppix/foo /mnt/img.2/home/knoppix
      cd
      umount /mnt/hda1 /mnt/img.1 /mnt/img.2
      rmdir /mnt/hda1 /mnt/img.1 /mnt/img.2
      exit

    Good luck and let us know how things go.

    Regards,
    - Robert
    http://www.cwelug.org/

Similar Threads

  1. New to Knoppix, need persistant disk image
    By Knopperdude in forum MS Windows & New to Linux
    Replies: 2
    Last Post: 04-20-2009, 12:33 AM
  2. How to copy/move persistant image file?
    By slvrldy17 in forum General Support
    Replies: 1
    Last Post: 01-16-2007, 03:22 PM
  3. Replies: 4
    Last Post: 03-23-2006, 08:04 PM
  4. persistant disk image - no x server found for your card
    By Scorpaen in forum General Support
    Replies: 0
    Last Post: 07-08-2005, 09:31 PM
  5. Creating persistant disk image on external HDD
    By mark.johnson in forum Hardware & Booting
    Replies: 2
    Last Post: 05-20-2005, 11:07 PM

Posting Permissions

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


IBM Power 720 POWER7 00E6516 3.6GHz CPU 64GB RAM Server  picture

IBM Power 720 POWER7 00E6516 3.6GHz CPU 64GB RAM Server

$209.98



IBM Power S822 12-Bay Server System Power8 Core 3.42Ghz DVD-Rom Drive 64GB No HD picture

IBM Power S822 12-Bay Server System Power8 Core 3.42Ghz DVD-Rom Drive 64GB No HD

$399.99



IBM 7944AC1 System x3550 M3 Server 1*Intel Xeon X5650 2.67GHz 4GB SEE NOTES picture

IBM 7944AC1 System x3550 M3 Server 1*Intel Xeon X5650 2.67GHz 4GB SEE NOTES

$27.25



ibm server z series picture

ibm server z series

$16000.00



IBM Power S822 8284-22A 12SFF Power8 3.89GHz 6-Core 64GB RAM No Bezel/HDD Server picture

IBM Power S822 8284-22A 12SFF Power8 3.89GHz 6-Core 64GB RAM No Bezel/HDD Server

$319.99



IBM SYSTEM x3200 M2 Server - HDD wiped, No OS picture

IBM SYSTEM x3200 M2 Server - HDD wiped, No OS

$75.00



IBM Lenovo X3650 M5 2U 8x 2.5” CTO Rack Server – 2x HS, 2x 750W picture

IBM Lenovo X3650 M5 2U 8x 2.5” CTO Rack Server – 2x HS, 2x 750W

$199.00



IBM BladeCenter HS21 7995 AC1 Server - 1x Xeon E5440 2GB RAM - NO HDDs picture

IBM BladeCenter HS21 7995 AC1 Server - 1x Xeon E5440 2GB RAM - NO HDDs

$22.43



IBM System X3500 M4 7383AC1 (E5-2650 v2 2.60GHz - 192GB RAM - M2000 - NO OS/HDD) picture

IBM System X3500 M4 7383AC1 (E5-2650 v2 2.60GHz - 192GB RAM - M2000 - NO OS/HDD)

$294.92



IBM SYSTEM x3650 M4 Xeon E5-2609 2.40GHZ 16GB DDR3-1066MHZ 2x 550W PSU TESTED picture

IBM SYSTEM x3650 M4 Xeon E5-2609 2.40GHZ 16GB DDR3-1066MHZ 2x 550W PSU TESTED

$109.95