🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.linux.setup
7 messages
7 total messages Started by Darren Mackay Tue, 04 Aug 1998 00:00
Writing fat16 partition from image file
#213
Author: Darren Mackay
Date: Tue, 04 Aug 1998 00:00
23 lines
1233 bytes
Hi,

Is is possible to this in linux?

1. Create an image file of a fat16 partition.

and if so

2. Can the image file be written directly to empty drive space

and if so

3. How can I set the active partition using a script

This will be used hopefully for automated cloning of DOS/Win,
Win95 and Win98 workstations (workstations using dhcp clients,
same hardware config and computer name has to be manually set),
also, I would like a quick method for getting machine back to
running after users stuff around with their computer, etc...

Thanks

Darren
Re: Writing fat16 partition from image file
#200
Author: Brian McCauley
Date: Tue, 04 Aug 1998 00:00
30 lines
1888 bytes
"Darren Mackay" <dcmackay@tech-center.com> writes:

> Is is possible to this in linux?
> 
> 1. Create an image file of a fat16 partition.

I tried the other day and failed.  mkfs.msdos seems to require
knowlege of the disk geometry.  An image file has no geometry.  You
could of course use a parition then read it into a file.

> 2. Can the image file be written directly to empty drive space

I'm assuming if you need geometry to create a FAT16 fs this info is
actually needed by something.  I'd guess this means that an image file
from a parition with one geometry would fail if you wrote it to one
with another.

> 3. How can I set the active partition using a script

There's a program called "activate" out there somewhere but I've not
looked at it for several years.  It exists (or at least existed) for
DOS and Linux.

-- 
    \\   ( )   No Bullshit!   | Email: B.A.McCauley@bham.ac.uk
 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)
.__/  \\ /\@  /~)  /~[   /\/[ |   +44 121 627 2173 (voice) 2175 (fax)
.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/
###LL  LL\\ (Brian McCauley)  | Finger: bam@wcl-rs.bham.ac.uk
Re: Writing fat16 partition from image file
#201
Author: Howard Johnson
Date: Tue, 04 Aug 1998 00:00
36 lines
2552 bytes
In article <togu0lmq9.fsf@wcl-l.bham.ac.uk>,
Brian McCauley  <B.A.McCauley@bham.ac.uk> wrote:
>"Darren Mackay" <dcmackay@tech-center.com> writes:

>> Is is possible to this in linux?
>> 1. Create an image file of a fat16 partition.
>I tried the other day and failed.  mkfs.msdos seems to require
>knowlege of the disk geometry.  An image file has no geometry.  You
>could of course use a parition then read it into a file.

Why not build the fat16 partition directly using DOS/Windows?  Then it
could be copied out to an image file with Linux or a custom DOS program.

>> 2. Can the image file be written directly to empty drive space
>I'm assuming if you need geometry to create a FAT16 fs this info is
>actually needed by something.  I'd guess this means that an image file
>from a parition with one geometry would fail if you wrote it to one
>with another.

True.  The partitions must be of identical size, and each image would
need to run on essentially identical hardware.  In addition, the
geometry (number of heads/cylinder and sectors/track) according to
INT13 convention would need to be the same.  I've been able to move
DOS/Win16 partitions around (to different starting cylinders), but I
haven't had as much luck with Win95.

>> 3. How can I set the active partition using a script
>
>There's a program called "activate" out there somewhere but I've not
>looked at it for several years.  It exists (or at least existed) for
>DOS and Linux.

I'd be a bit concerned about what got written to the boot sector also.

I don't know how picky mkfs.msdos is about disk geometry.  I have been
able to create ext2 partitions using /dev/loop* pseudo-devices.
Re: Writing fat16 partition from image file
#202
Author: Rod Smith
Date: Tue, 04 Aug 1998 00:00
108 lines
5924 bytes
[Posted and mailed]

In article <6q5uq5$338$1@bunyip.cc.uq.edu.au>,
	"Darren Mackay" <dcmackay@tech-center.com> writes:

Note:  In the below, I use /dev/sda1 as an example only; any other
partition designation would work as well, if that's the source/target.

> Is is possible to this in linux?
> 
> 1. Create an image file of a fat16 partition.

If you mean, create a big empty file (say, via "dd if=/dev/zero of=foo.img
bs=x count=y") and then use mkdosfs to create a FAT filesystem on it, I
don't know.  If you mean, do something like "dd if=/dev/sda1 of=foo.img"
on an EXISTING FAT partition, then the answer is a definite "yes."  I've
done this before and successfully restored it, both with FAT-16 and NTFS
partitions (not FAT-32 that I can recall, but I don't see why it wouldn't
work).

> 2. Can the image file be written directly to empty drive space

How empty is empty?  If you mean you've got the partition set up but it's
got no data on it, then yes.  In my example above, you'd just reverse the
process -- "dd if=foo.img of=/dev/sda1".  If you mean that the entire
drive is empty, you'd first need to create an appropriate partition. 
Also, be aware that any change in the partition size, disk geometry, etc.,
could ruin the results.  More on this later.

> 3. How can I set the active partition using a script

I don't know, but see below.

> This will be used hopefully for automated cloning of DOS/Win,
> Win95 and Win98 workstations (workstations using dhcp clients,
> same hardware config and computer name has to be manually set),
> also, I would like a quick method for getting machine back to
> running after users stuff around with their computer, etc...

If you're building a bunch of standardized PCs with identical hard
drives, using a partition image might make sense.  In fact, if the hard
drives are absolutely identical, it might make sense to forget about an
image of the PARTITION, and do an image of the ENTIRE DRIVE -- e.g., "dd
if=/dev/sda of=foo.img" (note /dev/sda, not /dev/sda1).  This will have
the advantage of preserving the active partition information and
obviating the need to muck with fdisk at all.

If the disk geometries aren't identical, however, there's a good chance
that your restored partition won't be bootable, or even useable.  This is
especially the case if you do the whole-drive method.  If you just do the
partition, you'll have to be very careful that the target partition is at
least as large as the original.  If it's smaller, dd will simply not
restore the whole thing, and it might work for a while, but the FAT will
indicate that the partition is bigger than it is, so as soon as an
attempt is made to write to a part of the drive that's past the
partition's ACTUAL end, Bad Things will happen.  If the source partition
is smaller than the target, my experience indicates that it will work but
might confuse disk utilities like Partition Magic or Norton Utilities.

One more flexible approach would be to use tar to back up the individual
files.  E.g.:

mount -t vfat /dev/sda1 /mnt/dos
tar cvf foo.tar /mnt/dos
umount /mnt/dos

Then to restore on another physical disk (I'm assuming the disks are
physically swapped, and that the new one has been partitioned):

mkdosfs /dev/sda1
mount -t vfat /dev/sda1 /mnt/dos
cd /
tar xvf foo.tar
umount /mnt/dos

(Of course, you might want or need more parameters on various of these
commands, to specify creating a FAT-32 filesystem, to gzip the tar file,
etc.  You could also do a "FORMAT C:" on the drive from DOS instead of
using mkdosfs.)

I've also done this many times.  It works quite well, even with FAT-32
partitions (assuming you've got appropriate support in your kernel), with
a few caveats.  Specifically, you lose certain DOS file attributes, like
the system, hidden, and archive bits.  Previously hidden files may then
re-appear after restoration.  Filename case may get changed in some
cases; namely, if the original partition has an all-lowercase 8.3 name
that's stored as all-lowercase via the special VFAT entries, it'll be
restored without the VFAT extensions, leading to a capitalized or
all-uppercase entry in programs, depending upon how they handle it.  I've
heard that this approach may not handle filenames with certain non-ASCII
characters well, which may be important in non-English-speaking
countries (but perhaps this has changed with some of the additions made
with FAT-32 support).  You'll also need to boot a DOS/Win95/Win98 floppy
and do a SYS C: to make the partition bootable, if it's supposed to be
bootable.

Anyhow, if your hard disks are a mish-mash of different models, this is
the way to go.  If they're all identical, a "dd" of the entire disk,
including partition table, may be the quickest way to do things.  You
could always mount the image via a loopback device and use tar to copy the
files over to the new disk if you've got a handful of oddball target
disks, too.

-- 
Rod Smith
rodsmith@fast9.uceprotect.net
http://www.users.fast.net/~rodsmith
NOTE: Remove the digit and following word from my address to mail me
Re: Writing fat16 partition from image file
#214
Author: Ignacio
Date: Tue, 04 Aug 1998 00:00
35 lines
1676 bytes
On Tue, 4 Aug 1998 13:22:44 +1000, "Darren Mackay"
<dcmackay@tech-center.com> wrote:

>Hi,
>
>Is is possible to this in linux?
>
>1. Create an image file of a fat16 partition.

Hmm...that I don't know. It should if mkfs can make a fat partition.

>2. Can the image file be written directly to empty drive space

Use dd to transfer it onto the partition.

>3. How can I set the active partition using a script

Hmm...probably not. You'd probably have to read the partition table,
do some bit-twiddling, and then write it back. There may be a utility
for this, however. Anyone?

>This will be used hopefully for automated cloning of DOS/Win,
>Win95 and Win98 workstations (workstations using dhcp clients,

Heh, poetic justice.

>same hardware config and computer name has to be manually set),
>also, I would like a quick method for getting machine back to
>running after users stuff around with their computer, etc...
>
>Thanks
>
>Darren

Ignacio  <ivazquez@mapson_hotmail.com>
Re: Writing fat16 partition from image file
#204
Author: Kim Saunders
Date: Wed, 05 Aug 1998 00:00
11 lines
1132 bytes
>This will be used hopefully for automated cloning of DOS/Win,
>Win95 and Win98 workstations (workstations using dhcp clients,
>same hardware config and computer name has to be manually set),
>also, I would like a quick method for getting machine back to
>running after users stuff around with their computer, etc...


Go to http://www.ghostsoft.com and get GHOST, this clones drives, takes care
of partitions, fits on a floppy.

KimS
Re: Writing fat16 partition from image file
#206
Author: Darren Mackay
Date: Wed, 05 Aug 1998 00:00
5 lines
782 bytes
Rod,

Thanks, it appears to be actually working!

Darren
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads