{"id":334,"date":"2012-05-18T01:50:38","date_gmt":"2012-05-17T23:50:38","guid":{"rendered":"http:\/\/wp.oktay.com\/?p=334"},"modified":"2012-08-17T00:03:40","modified_gmt":"2012-08-16T22:03:40","slug":"mount-image-files-partition","status":"publish","type":"post","link":"https:\/\/wp.oktay.com\/?p=334","title":{"rendered":"mount image file&#8217;s partition"},"content":{"rendered":"<pre>fdisk -ul image.img\r\nYou must set cylinders.\r\nYou can do this from the extra functions menu.\r\nDisk image-sda: 0 MB, 0 bytes\r\n255 heads, 63 sectors\/track, 0 cylinders, total 0 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nDevice     Boot Start End      Blocks    Id System\r\nimage.img *    63    78140159 39070048+ 7  HPFS\/NTFS\r\nPartition 1 has different physical\/logical endings:\r\nphys=(1023, 254, 63) logical=(4863, 254, 63)<\/pre>\n<pre># mount -o loop,offset='''32256''' -t auto image.img mnt\/<\/pre>\n<pre><\/pre>\n<pre><\/pre>\n<pre><\/pre>\n<pre>JFFS2<\/pre>\n<pre>-----<\/pre>\n<p><code><\/p>\n<pre>#!\/bin\/bash<\/pre>\n<p>if [ $# -eq 0 ]; then<br \/>\necho $0 JFFS2_IMAGE_FILE<br \/>\nexit<br \/>\nfi<\/p>\n<p>modprobe mtdram total_size=44576 erase_size=128<br \/>\nmodprobe mtdblock<br \/>\ndd if=\"$1\" of=\/dev\/mtdblock0<br \/>\nmount -t jffs2 \/dev\/mtdblock0 m<\/code><br \/>\n&#8212;&#8212;&#8212;<\/p>\n<p>cat \/proc\/mtd for information of mtd device<\/p>\n<p>.&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><em>unpack:<\/em> rootfs<br \/>\n cat rootfs.gz | lzma -d | cpio -id -H newc<br \/>\nor<br \/>\ncat rootfs.gz | gunzip -c | cpio -id -H newc<\/p>\n<p><em>pack:<\/em><\/p>\n<p>dd if=\/dev\/zero of=rootfs1 bs=1k count=8192<br \/>\nmke2fs -q -F -m 0 -i 1024 rootfs1<\/p>\n<p>mkdir -p rfs<br \/>\nsudo mount -t ext2 -o loop rootfs1 rfs<br \/>\n  cd rfs<br \/>\n  tar &#8211;exclude=&#8221;*\/lib*\\.a&#8221; &#8211;exclude=&#8221;*\/man\/*&#8221; &#8211;exclude=&#8221;*\/include\/*&#8221; -cpf &#8211; * | \\<br \/>\n    sudo tar -C rfs -xf &#8211;<br \/>\n\/\/  sudo chown -h -R 0:0 rfs<\/p>\n<p> find .\/rfs | cpio -o -H newc | gzip -9 > rootfs.gz<br \/>\nsudo umount rfs<\/p>\n<p>\/\/gzip -9 -c rootfs1 > rootfs.gz<\/p>\n<p><code>better to unpack with<br \/>\ncpio -id --no-absolute-filenames<\/code><br \/>\nor you will smash your linux&#8230; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>fdisk -ul image.img You must set cylinders. You can do this from the extra functions menu. Disk image-sda: 0 MB, 0 bytes 255 heads, 63 sectors\/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System image.img * 63 78140159 39070048+ 7 HPFS\/NTFS&hellip; <a class=\"more-link\" href=\"https:\/\/wp.oktay.com\/?p=334\">Continue reading <span class=\"screen-reader-text\">mount image file&#8217;s partition<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,40],"tags":[],"class_list":["post-334","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux","entry"],"_links":{"self":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/posts\/334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":8,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/347"}],"wp:attachment":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}