Bug#29153: Bug#31607: cfdisk reported to not work on 'factory clean', unpartitioned drives
On Fri, 8 Jan 1999 18:36:48 +0100 (CET), Vincent Renardias <vincent@ldsol.com> said:
> On Fri, 8 Jan 1999, Adam Di Carlo wrote:
>> There are reports that cfdisk indeed does not do well on drives
>> with no partition table yet created at all. This is different from
>> just having no partitions. Although I'm not sure off the bat how
>> to create this condition (I think you can use 'fmthard' in
>> solaris).
> Both fdisk and cfdisk accept the '-z' option with creates a new
> empty partition table. Is this what you need?
Hmm. Maybe. Does it create a new one unconditionally? Or should it
be run as a fallback plan?
Enrique, do you have any comments?
> (NB: Could you send me the manpage of Solaris' fmthard? I don't any
> any Solaris box around)
Included below, though I don't know how useful it is to you.
In Solaris hardware (sparc) they have VTOC's, not partition tables.
They taught me in class that I can scribble on the vtoc, i.e.,
simulate disk failure, by doing this:
echo '0 0 00 0 0' | fmthard -s - /dev/rdsk/<diskname>
--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>
Maintenance Commands fmthard(1M)
NAME
fmthard - populate VTOC on hard disks
SPARC SYNOPSIS
fmthard -d data | -n volume_name | -s datafile
[ -i ] /dev/rdsk/c?[t?]d?s2
x86 SYNOPSIS
fmthard -d data | -n volume_name | -s datafile
[ -i ][ -p pboot ][ -b bootblk ] /dev/rdsk/c?[t?]d?s2
DESCRIPTION
The fmthard command updates the VTOC (Volume Table of Con-
tents) on hard disks and, on x86 systems, adds boot informa-
tion to the Solaris fdisk partition. One or more of the
options -s datafile, -d data, or -n volume_name, must be
used to request modifications to the disk label. To print
disk label contents, see prtvtoc(1M). The
/dev/rdsk/c?[t?]d?s2 file must be the character special file
of the device where the new VTOC is to be installed. On x86
systems, fdisk(1M) must be run on the drive before fmthard.
If you are using an x86 system, note that the term ``parti-
tion'' in this page refers to slices within the x86 fdisk
partition on x86 machines. Do not confuse the partitions
created by fmthard with the partitions created by fdisk.
OPTIONS
The following options apply to fmthard:
-i This option allows the command to create
the desired VTOC table, but prints the
information to standard output instead of
modifying the VTOC on the disk.
-d data The data argument of this option is a
string representing the information for a
particular partition in the current VTOC.
The string must be of the format
part:tag:flag:start:size where part is the
partition number, tag is the ID TAG of the
partition, flag is the set of permission
flags, start is the starting sector number
of the partition, and size is the number of
sectors in the partition. See the descrip-
tion of the datafile below for more infor-
mation on these fields.
-n volume_name This option is used to give the disk a
volume_name up to 8 characters long.
-s datafile This option is used to populate the VTOC
SunOS 5.6 Last change: 25 Aug 1995 1
Maintenance Commands fmthard(1M)
according to a datafile created by the
user. If the datafile is "-", fmthard
reads from standard input. The datafile
format is described below. This option
causes all of the disk partition timestamp
fields to be set to zero.
Every VTOC generated by fmthard will also have partition 2,
by convention, that corresponds to the whole disk. If the
input in datafile does not specify an entry for partition 2,
a default partition 2 entry will be created automatically in
VTOC with the tag V_BACKUP and size equal to the full size
of the disk.
The datafile contains one specification line for each parti-
tion, starting with partition 0. Each line is delimited by
a new-line character (\n). If the first character of a line
is an asterisk (*), the line is treated as a comment. Each
line is composed of entries that are position-dependent,
separated by "white space" and having the following format:
partition tag flag starting_sector size_in_sectors
where the entries have the following values.
partition The partition number: 0-15 decimal or
0x0-0xf hexadecimal.
tag The partition tag: a two-digit hex number.
The following are reserved codes: 0x00
(V_UNASSIGNED), 0x01 (V_BOOT), 0x02
(V_ROOT), 0x03 (V_SWAP), 0x04 (V_USR), 0x05
(V_BACKUP), 0x06 (V_STAND), 0x07 (V_VAR)
and 0x08 (V_HOME).
flag The flag allows a partition to be flagged
as unmountable or read only, the masks
being: V_UNMNT 0x01, and V_RONLY 0x10.
For mountable partitions use 0x00.
starting sector The sector number (decimal) on which the
partition starts.
size in sectors The number (decimal) of sectors occupied by
the partition.
Note that you can save the output of a prtvtoc command to a
file, edit the file, and use it as the datafile argument to
the -s option.
x86 Options
The functionality provided by the following two x86 options
SunOS 5.6 Last change: 25 Aug 1995 2
Maintenance Commands fmthard(1M)
is also provided by installboot(1M). Because the func-
tionality described here may be removed in future versions
of fmthard, you should use installboot to install boot
records. The following options currently apply to fmthard:
-p pboot This option allows the user to override the
default partition boot file,
/usr/platform/platform-name/lib/fs/ufs/pboot.
The partition boot file is platform depen-
dent, where platform-name can be determined
using the -i option to uname(1).
-b bootblk This option allows the user to override the
default bootblk file,
/usr/platform/platform-
name/lib/fs/ufs/bootblk. The boot block file
is platform dependent, where platform-name
can be determined using the -i option to
uname(1).
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
__________________________________
| ATTRIBUTE TYPE| ATTRIBUTE VALUE|
|_______________|_________________|_
| Availability | SUNWcsu |
|_______________|_________________|
SEE ALSO
uname(1), format(1M), prtvtoc(1M), attributes(5)
x86 Only
fdisk(1M), installboot(1M)
NOTES
Special care should be exercised when overwriting an exist-
ing VTOC, as incorrect entries could result in current data
being inaccessible. As a precaution, save the old VTOC.
fmthard cannot write a disk label on an unlabeled disk. Use
format(1M) for this purpose.
SunOS 5.6 Last change: 25 Aug 1995 3
Reply to: