Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Script to resize embedded images

    Problems Installing or Upgrading pfSense Software
    5
    12
    27.1k
    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.
    • M
      marzl
      last edited by

      Hi,

      New in this Forum, i say hello to everyone interested.
      I have recreate a skript to create 128, 256, 512 or 1gb Images out of the original 64mb embedded one.
      Works only on FreeBSD, feel free to modify it for Linux.

      How to use:
      Save skript in your homedir.
      #> mv mkflash_new.txt mkflash_new.sh
      #> chmod +x mkflash_new.sh
      Download latest Snapshot from http://www.pfsense.com/~sullrich/
      Get pfSense.img.gz from there and place it in your homedir
      Unpack pfSense.img.gz with
      #> gzip -d pfSense.img.gz
      Be shure to get root-rights
      #> su
      execute skript like:
      Usage: /home/marcel/mkflash_new.sh {128|252|512|1024} {Originalimage}
      Example: #> /home/marcel/mkflash.sh 128 /home/marcel/pfSense.img

      Voila, take a look on the new image-file:
      pfSense-128MB.img.gz
      pfSense-128MB.img.gz.md5

      Have fun,
      Marcel

      edit: changed heading to resize image….
      mkflash_new.txt

      1 Reply Last reply Reply Quote 0
      • H
        hoba
        last edited by

        Feel free to add this to our wiki at wiki.pfsense.com  :)

        1 Reply Last reply Reply Quote 0
        • M
          marzl
          last edited by

          http://wiki.pfsense.com/wikka.php?wakka=FlashHowToSkript

          1 Reply Last reply Reply Quote 0
          • J
            jakee
            last edited by

            :) very good

            1 Reply Last reply Reply Quote 0
            • belleraB
              bellera
              last edited by

              I have troubles using it in a FreeBSD 6.2 machine:

              ./mkflash_new.sh 256 pfSense.img.gz

              abr 19 17:16:32: Creating 256MB Compact Flash
              abr 19 17:16:32: And using pfSense.img.gz as source image.
              abr 19 17:16:32:
              abr 19 17:16:32:        Real flash size: 222 MB
              abr 19 17:16:32:        root size: 218, root blocks: 446464
              abr 19 17:16:32:        conf size: 4, conf blocks: 8192 446464
              abr 19 17:16:32:        cylinders: 888, heads: 16, sectors: 32
              abr 19 17:16:32:
              abr 19 17:16:32: Creating empty 256MB flash image in /usr/home/super/pfsense
              abr 19 17:16:45:
              abr 19 17:16:45: Preparing Filesystems on /usr/home/super/pfsense/pfSense-256MB.img
              abr 19 17:16:45:        Bsdlabel
              abr 19 17:16:45:        Newfs
              abr 19 17:16:45:
              abr 19 17:16:45: Extracting content from pfSense.img.gz
              mount: /dev/md0a: No such file or directory
              mount: /dev/md0d: No such file or directory

              abr 19 17:16:45:        -> /usr/home/super/pfsense/pfSense-slash.tar.bz2
              abr 19 17:16:45:        -> /usr/home/super/pfsense/pfSense-conf.tar.bz2
              umount: /dev/md0a: statfs: No such file or directory
              umount: /dev/md0a: unknown file system
              umount: /dev/md0d: statfs: No such file or directory
              umount: /dev/md0d: unknown file system

              abr 19 17:16:46:
              abr 19 17:16:46: Restoring content to /usr/home/super/pfsense/pfSense-256MB.img
              abr 19 17:16:46:        <- /usr/home/super/pfsense/pfSense-slash.tar.bz2
              abr 19 17:16:46:        <- /usr/home/super/pfsense/pfSense-conf.tar.bz2
              abr 19 17:16:47:        Cleanig up.
              abr 19 17:16:47:
              abr 19 17:16:47: Compressing /usr/home/super/pfsense/pfSense-256MB.img
              abr 19 17:17:04:        Creating MD5 hash
              abr 19 17:17:04:
              abr 19 17:17:04: READY! Now you have a 256MB pfSense image.
              abr 19 17:17:04: You can get this image on your CF Card using:
              abr 19 17:17:04: zcat /usr/home/super/pfsense/pfSense-256MB.img.gz | dd of=/dev/da0 bs=16k

              Please, help!

              Josep Pujadas

              1 Reply Last reply Reply Quote 0
              • M
                marzl
                last edited by

                It seems there is no support fpr Memory Disks on your System.
                Does a```
                #> kldload /boot/kernel/geom_md.ko

                1 Reply Last reply Reply Quote 0
                • belleraB
                  bellera
                  last edited by

                  kldload /boot/kernel/geom_md.ko

                  kldload: can't load /boot/kernel/geom_md.ko: File exists

                  Any other idea?

                  Thanks,

                  Josep Pujadas

                  1 Reply Last reply Reply Quote 0
                  • M
                    marzl
                    last edited by

                    The Sourceimage has to be decompressed FIRST!

                    Use```
                    #>./mkflash_new.sh 256 pfSense.img

                    1 Reply Last reply Reply Quote 0
                    • belleraB
                      bellera
                      last edited by

                      I'm very sorry!

                      I forgot gunzip the image file before running the script …

                      Many thanks!

                      Josep Pujadas

                      1 Reply Last reply Reply Quote 0
                      • V
                        Veni
                        last edited by

                        What values should i use inside the following variables:

                        • flash_MB

                        • conf_MB

                        • heads

                        • sectors

                        for a 2 GB CF card
                        if i wanted to modify the script(http://wiki.pfsense.com/wikka.php?wakka=FlashHowToSkript ) to support 2 GB cards?

                        1 Reply Last reply Reply Quote 0
                        • belleraB
                          bellera
                          last edited by

                          Hello!

                          I don't know if it is standard, but I found at http://www.industrialcompactflash.com/datasheets/wincflash.pdf :

                          Table 48: Product Capacity & Part Numbering

                          | Card Capacity Part Number Real Capacity Total Sectors/Card (Max LBA+1) Cylinders Heads Sectors |
                          | 128 MB CFLASH-G-128-I 131MB 256,512 1,002 8 32 |
                          | 256 MB CFLASH-G-256-I 262MB 513,536 1,003 16 32 |
                          | 512 MB CFLASH-G-512-I 526MB 1,028,160 1,020 16 63 |
                          | 1 GB CFLASH-G-1024-I 1,054MB 2,060,352 2,044 16 63 |
                          | 2 GB CFLASH-G-2048-I 2,118MB 4,136,832 4,104 16 63 |
                          | 4 GB CFLASH-G-4204-I 4,204MB 8,211,168 8,146 16 63 |
                          | 8 GB CFLASH-G-8415-I 8,415MB 16,435,440 16,305 16 63 |

                          Regards,

                          Josep Pujadas

                          1 Reply Last reply Reply Quote 0
                          • V
                            Veni
                            last edited by

                            Nice, thanks :D.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.