LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to convert .tgz to .img ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-convert-tgz-to-img-802900/)

yeehi 04-19-2010 01:15 PM

How to convert .tgz to .img ?
 
I have a file (.tgz) which is meant to be simply copied to a floppy disc.
I donīt have a floppy disc, so I would like to convert the file to a .img file, so that it looks like a floppy disc but is on my hard drive.

How do I do this? I have looked quite a lot. Surely there is some application that does it easily.

(In case it helps, this is for installation of Basic Linux, which comes on two floppy discs with ms-dos file systems.

reed9 04-19-2010 01:29 PM

The dd command can do this. Though .tgz indicates it's a compressed archive. Are you sure you don't want whatever is in the archive?

Anyway, it would be something like
Code:

dd if=/path/to/input/file.tgz of=/path/to/output/file.img
http://www.linuxquestions.org/questi...ommand-362506/

yeehi 04-19-2010 01:44 PM

Thank you! I got some output:

Quote:

2745+1 records in
2745+1 records out
1405907 bytes (1.4 MB) copied, 0.220642 s, 6.4 MB/s
But no file seems to have been created in the directory where I ran the command. (I ran the command from the fileś folder.)

How do I get that file?

Are you sure you don't want whatever is in the archive?
I am not exactly sure, but I think it will be ok as it is.

reed9 04-19-2010 01:50 PM

What output directory did you put in the command?

yeehi 04-19-2010 02:44 PM

Quote:

Originally Posted by reed9 (Post 3940605)
What output directory did you put in the command?

Ooh! I didnīt put in the full path to the output directory! Anyway, I found the .img file and moved it to the correct folder.

Unfortunately, it still wonīt work, as it seems my problem is a bit more complicated:

the .img file isnīt of use as it didnīt have a DOS file system on it. I think i need to create a .img file, mount it, put a dos file system on it, copy over the file, unmount it. That is my guess. I donīt know whether that is correct, or how to do it. Also, I dont think this process I suggested will actually leave me a .img file in my folder as required.

I tried doing something like this before but it didnt work. One thing is that nautilus cant handle places - there was some error message with this.

I hope you can still help!

Thank you! :)

reed9 04-19-2010 02:52 PM

Perhaps you can tell us more about the file? What is it exactly? Where did you get it?

MTK358 04-19-2010 03:05 PM

I am almost certain the file is an archive containing the image, else why would it be called ".tgz"?

yeehi 04-19-2010 03:05 PM

It is a Basic Linux set up download.

The download is meant to produce stuff for two floppy discs. I wont be using floppys - I will be doing it all from a hard disk using a virtual machine.

MTK358 04-19-2010 03:07 PM

Perhaps the archive contains two images — one for each floppy?

And no, putting files in a compressed archive is not at all like sticking them together.

reed9 04-19-2010 03:30 PM

I just checked. Yes, there is already an image file in the archive. That is what you want to use as the image file for VirtualBox.

The readme included in the archive is as follows:
Quote:

Welcome to BasicLinux 3.5
~~~~~~~~~~~~~~~~~~~~~~~~~
BL3 is a mini-Linux designed specifically for old PCs. It provides a slim
2.2.26 kernel, a user-friendly shell and a good assortment of utilities.
BL3 includes a web browser, comm program, mail client, telnet client, wget,
DHCP and dial-up PPP. It also has a small-footprint GUI and some graphical
applications, including the MagicPoint presentation tool.

This version of BasicLinux boots from two floppies and runs in a ramdisk.
It has an option to install itself onto a Linux harddrive partition.

Minimum requirements for the floppy version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Intel 386 or compatible
12mb RAM
two blank floppies (DOS format)

How to put BasicLinux on the floppies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the zip file, you will find disk1.img and disk2.tgz. Floppy 2 is easy.
Simply copy disk2.tgz to an empty DOS floppy and label it floppy 2.

Floppy 1 is more complicated -- a simple copy is not enough. You have to
write the raw image (disk1.img) to the floppy.

In Linux, this is done with the dd command:
---------------------------
dd if=disk1.img of=/dev/fd0
---------------------------

In DOS, you use rawrite.exe or fdimage.exe to write raw images.
The BL3 zip file includes fdimage.exe. Here is the command:
---------------------
fdimage disk1.img a:
---------------------

WARNING: The floppy used for disk 1 must be perfect (no bad sectors).
The routines for writing raw images are not error-tolerant.


Starting BasicLinux
~~~~~~~~~~~~~~~~~~~
Insert floppy 1 and reboot the system. Floppy 1 will boot Linux and tell
you when to insert floppy 2. When floppy 2 has finished loading, remove it.

PCMCIA
~~~~~~
BL3 is able to use older PCMCIA cards (serial, IDE and PCnet). To activate
a card, insert it in the PCMCIA slot and then execute: /etc/pcmcia/start

Networking
~~~~~~~~~~
BasicLinux has good networking capabilities. To help you configure your
network interface, BasicLinux includes a file called "netsetup", which
outlines the steps to follow. Just edit "netsetup" to match your situation
and execute it.

If you have a suitable modem, you can run pppsetup to configure a connection
to your Internet Service Provider. Note: many of the modems in Windows
computers are designed to work only with Windows -- they do not work with
BasicLinux.

Installing BasicLinux to harddisk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From inside BL3, use fdisk and mke2fs to create a Linux partition on your
harddisk. Mount that partition at /hd and execute install-to-hd.

Disclaimer
~~~~~~~~~~
BasicLinux is free software. I have done my best to make it error-free,
but there is no guarantee regarding its fitness for any purpose. You use
it at your own risk.

BasicLinux 3 is designed for old PCs with limited RAM. It is not suitable
for mission-critical systems and should not be used on systems containing
irreplaceable data.

yeehi 04-19-2010 03:45 PM

I need the .img file that comes with the download for sure. The good thing about it is that it works well as it is on the hard disk. I donīt have to change it. It is the first ĻfloppyĻ. (How I wish the second floppy were like this format!)

There are two floppys needed though. Launching that first .img file runs well but then it says insert the second floppy. It is this second floppy with which I am having trouble, because it isnīt a .img file. It is a .tgz file.

I have tried unpacking the .tgz file in the hope that it is a .img. It does not unpack to a .img. I need to somehow get that DISK2.TGZ put onto a a DOS file system floppy .img file.

Please help! :)

MTK358 04-19-2010 03:51 PM

You are supposed to copy disk2.tgz onto the second floppy as a normal file, it is not an image.

yeehi 04-19-2010 04:10 PM

Quote:

Originally Posted by MTK358 (Post 3940738)
You are supposed to copy disk2.tgz onto the second floppy as a normal file, it is not an image.

Yes, I know that I should put the DISK2.TGZ file onto a real floppy disc. That would be easy, if I had a real floppy disc and a real floppy drive. I have neither real floppy disc nor real floppy drive. I am trying to do this all off a hard disk and will use a virtual machine.

So, could somebody tell me how I could create a .img file that looks like a DOS floppy disc that has had the DISK2.TGZ file moved onto it?

I hope so! :)

MTK358 04-19-2010 04:14 PM

You're doing this in a virtual machine, right?

If you're trying to fake a real computer having a floppy drive, I doubt it's possible.

Anyway, I don't know how to make an image of a DOS floppy and copy stuff to it.

yeehi 04-19-2010 04:22 PM

Quote:

Originally Posted by MTK358 (Post 3940756)
Anyway, I don't know how to make an image of a DOS floppy and copy stuff to it.

I am running all these commands on a real installation of Ubuntu. Once I have eventually made the second floppy disc image, i will use a virtual machine for installation.

Quote:

Originally Posted by MTK358 (Post 3940756)
Anyway, I don't know how to make an image of a DOS floppy and copy stuff to it.

This might help!

I have tried to follow these instructions:

Quote:

let's create an empty image, make fs
Code:

dd if=/dev/zero of=floppy.img bs=512 count=2880
mkdosfs floppy.img

now, let's create a mountpoint and mount it
Code:

sudo mkdir /media/image
sudo mount -o loop floppy.img /media/image

the mounted image appears on the desktop, but you cant write to it
open nautilus in root mode or etc and copy some files
Code:

sudo nautilus /media/image

when you are finished
Code:

sudo umount -l /media/image

I didnt get it to work properly. The mounting/unmounting didnīt work out well. Nautilus canīt handle places was the error message.


All times are GMT -5. The time now is 09:32 AM.