LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2008, 11:11 AM   #1
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Rep: Reputation: 17
creating floppy images from directory


i am trying to create floppy images from a given directory. like e.g. the slackware rootdisk images. how do i do it?

i found a lot of stuff about making images from a floppy disk. or copying an image to a floppy disk but nothing about creating floppy images from directories. is it the same as with cd images. what's the fs type?

thx vadkutya
 
Old 05-19-2008, 01:25 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
You create a floppy image by copying a floppy using dd:

dd if=/dev/fd0 of=/tmp/floppy.image

If your data is currently in a file in a directory then copy the file to a clean floppy using the cp command and then use the dd command to copy the floppy to a floppy image file.

You can also make a floppy image directly from a data file without using a floppy intermediate. Mount a file on a loopback device and then use mkfs and dd to create a floppy partition on the loopback device. Then copy the data file to the loopback device.

Using a floppy intermediate is easier.

---------------------
Steve Stites
 
Old 05-19-2008, 01:40 PM   #3
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Original Poster
Rep: Reputation: 17
thx jailbait,

the floppy intermediate solution is quite obviouse. no wonder it didn't come to my mind . the second solution though would be more interesting. i know how to mount iso as loop device but the rest is beyond me? care to enlight me?

vadkutya
 
Old 05-19-2008, 01:59 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by vadkutya View Post
thx jailbait,

the floppy intermediate solution is quite obviouse. no wonder it didn't come to my mind . the second solution though would be more interesting.
You can mount any file which holds a filesystem as a loopback device. So, the trick would basically be the following:

1.- create a file full of zeroes which is exactly the same size of a floppy, you use dd for this (man dd). Tip: use /dev/zero as input source.

2.- format the file with the relevant filesystem. This can be any filesystem of your choice. It depends on what you are doing to do with the floppy. If you are going to create a linux disk, you probably want mkfs.ext2 or mkfs.ext3. If you want to use it in windows or dos, then you have many options, like mkfs.vfat or mkfs.msdos

3.- mount -o loop it.

4.- put anything you want into it.

5.- dump the image (with dd again) into the relevant device if you want.

Last edited by i92guboj; 05-19-2008 at 02:02 PM.
 
Old 05-19-2008, 02:35 PM   #5
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Original Poster
Rep: Reputation: 17
thank you very much

vadkutya
 
Old 05-19-2008, 03:11 PM   #6
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Original Poster
Rep: Reputation: 17
i spoke to soon. i have problems with point 2 "format the file with the relevant filesystem". ok, first i created a file full of zeros with:
Code:
 dd if=/dev/zero ibs=10 count=144 of=~/a0_bin.img
144+0 records in
2+1 records out
worked just fine:
Code:
 ls -l a0_bin.img 
-rw-r--r--  1 as users 1440 2008-05-19 21:43 a0_bin.img
but when i try to format the file as suggested:
Code:
# mke2fs -c -v a0_bin.img
mke2fs 1.38 (30-Jun-2005)
a0_bin.img is not a block special device.
Proceed anyway? (y,n) y
a0_bin.img: Invalid argument passed to ext2 library while setting up superblock
google search on "Invalid argument passed to ext2 library while setting up" is too much about bad superblock of hd's. read the man page of mke2fs. didn't find anything file specific. am i missing an option?

vadkutya
 
Old 05-20-2008, 02:42 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by vadkutya View Post
google search on "Invalid argument passed to ext2 library while setting up" is too much about bad superblock of hd's. read the man page of mke2fs. didn't find anything file specific. am i missing an option?

vadkutya
Well, I think that the problem is that the file is way too small (1.5kb). It can't even hold the basic ext2 structures.

You need to do the first step this way to get a bigger file:

Code:
dd if=/dev/zero ibs=1024 count=1440 of=~/a0_bin.img
 
Old 05-20-2008, 04:47 AM   #8
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Original Poster
Rep: Reputation: 17
thanks a lot, man. all steps work flawlessly. i am most greatful

vadkutya
 
Old 05-21-2008, 09:18 AM   #9
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Original Poster
Rep: Reputation: 17
i thought i write the whole procedure down with all the commands involved just in case i forget them :

1. creating a file of 1.44 MB full of zeros which will later serve as image file:
Code:
$ dd if=/dev/zero ibs=1024 count=1440 of=$IMGFILE
2. creating a filesystem in it (e.g. ext2) with mke2fs or mkfs.ext2:
Code:
# mke2fs $IMGFILE
3. mounting the file on a loop device:
Code:
# mount -o loop -t ext2 $IMGFILE /mnt
4. copy data
5. unmount the file:
Code:
# umount /mnt
EOP

vadkutya
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Useradd not creating home directory when creating newuser meneedham Linux - Newbie 4 10-05-2007 12:11 PM
Creating Images hsimah Linux - General 3 08-26-2006 09:12 PM
Creating movies from images vivekr Programming 2 02-16-2006 02:36 AM
creating my own drive images slinky2004 Linux - General 3 02-14-2006 01:54 PM
Creating floppy images. nutshell Linux - Software 2 07-06-2002 07:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration