Here's my old patch for it. This was against 1.5.1, but shouldn't be
too difficult to bring up to date. IOW, I longer use it...
Leland
On 6/27/11 5:17 PM, Tom Huegel wrote:
Leland,
Is your updated version generally available?
Thanks
Tom
On Mon, Jun 27, 2011 at 2:35 PM, Leland Lucius <lluc...@homerow.net
<mailto:lluc...@homerow.net>> wrote:
A few years ago, I modified dasdfmt to allow specification of the
start and end track for formatting. I was using LDL formatted volumes
do I didn't have to worry about the VTOC.
Usage: ./dasdfmt [-htvyLVFk]
[-l <volser> | --label=<volser>]
[-b <blocksize> | --blocksize=<blocksize>]
[-d <disk layout> | --disk_layout=<disk layout>]
[-s <track> | --start=<track>]
[-e <track> | --end=<track>]
<diskspec>
-t or --test means testmode
-c or --changeonly change disk layout only...no formatting
-V or --version means print version
-L or --no_label means don't write disk label
-w x or --wait=x means wait x seconds at 1 percent intervals
-s or --start means to start formatting at the specified track
-e or --end means to stop formatting at (and including) the
specified track
-p or --progressbar means show a progress bar
-m x or --hashmarks=x means show a hashmark every x cylinders
-v means verbose mode
-F means don't check if the device is in use
-k means keep volume serial
<volser> is the volume identifier, which is converted
to EBCDIC and written to disk.
(6 characters, e.g. LNX001
<blocksize> has to be power of 2 and at least 512
<disk layout> is either
'cdl' for compatible disk layout (default) or
'ldl' for linux disk layout
and <diskspec> is either
-f /dev/dasdX or --device=/dev/dasdX
if you do not use devfs
or
-f /dev/dasd/xxxx/device or --device=/dev/dasd/xxxx/device
and alternatively
-n xxxx or --devno=xxxx
in case you are using devfs.
xxxx is your hexadecimal device number.
Please report bugs to: linux...@de.ibm.com <mailto:linux...@de.ibm.com>
On Mon, Jun 27, 2011 at 4:23 PM, Tom Huegel <tehue...@gmail.com
<mailto:tehue...@gmail.com>> wrote:
> Maybe I left something out.
> Since this is CDL format there is a VTOC with an entry for the
partition
> extent.
> I can use a free CMS program LXFMT to update that label without
destroying
> any data.
> The gotcha is that I (LINUX) cannot use the additional DASD
because it is
> not in a 4K format.
>
> Another solution I thought of would be to define the mdisk to VSE
(I suppose
> z/OS would work too) then I could use JCL to create a file
appending the
> current LINUX partition and write a program (any language) to
open the file,
> write 4K records to the end. and close the file.
>
> Then go back to CMS for LXFMT to update the partition label.. and
then
> to LINUX to expand the file system..
>
> Safer than me calculating where to DDR copy to, but still a mess...
>
> On Mon, Jun 27, 2011 at 1:57 PM, Jonathan Quay
<jonathan.q...@ihg.com <mailto:jonathan.q...@ihg.com>>
> wrote:
>>
>> I don't think you can do what you want to do because the linux
partition
>> table won't see the extra cylinders. Nothing jumps off the page
on the
>> s390tools site. I think you are stuck with defining a bigger
minidisk and
>> copying the data over. LVM's are easy to extend and that is
what I use for
>> almost all my filesystems.
>>
>> On Mon, Jun 27, 2011 at 4:44 PM, Thomas Kern
<tlk_sysp...@yahoo.com <mailto:tlk_sysp...@yahoo.com>>
>> wrote:
>>>
>>> CPFMTXA can do that cylinder range formatting, but I don't know
if Linux
>>> will then allow you to do the resize2fs to enlarge the
filesystem control
>>> blocks. It would be worth a try on a TEST MINIDISK.
>>>
>>> /Tom Kern
>>>
>>>
>>> On Mon, 27 Jun 2011 13:28:49 -0700, Tom Huegel
<tehue...@gmail.com <mailto:tehue...@gmail.com>>
>>> wrote:
>>>
>>> >Tom,
>>> >Yea that would work too.
>>> >It just seems so simple to be able to format a cylinder range
(either in
>>> >LINUX or CMS) ie FORMAT A10 4K cyl 100:199.. It would just
write 4K
>>> > blocks
>>> >x'00's and be almost done with it. Then LINUX could expand the
>>> > filesystem
>>> >and away we go.
>>> >
>>> >At least it sounds simple.
>>> >
>>> >
>>> >
>>> >On Mon, Jun 27, 2011 at 1:11 PM, Thomas Kern
<tlk_sysp...@yahoo.com <mailto:tlk_sysp...@yahoo.com>>
>>> > wrote:
>>> >
>>> >> I always did it the old-fashioned way:
>>> >> 1) allocate a new 200 cyl minidisk
>>> >> 2) format it in linux
>>> >> 3) use linux tools to copy data from old to new
>>> >> 4) mount new instead of old
>>> >> 5) remove old from linux configuration
>>> >>
>>> >> /Tom Kern
>>> >>
>>> >>
>>> >> On Mon, 27 Jun 2011 10:35:46 -0700, Tom Huegel
<tehue...@gmail.com <mailto:tehue...@gmail.com>>
>>> >> wrote:
>>> >>
>>> >> >I have a minidisk that LINUX uses. It is defined and
formatted h use
>>> >> > CDL
>>> >> >format.
>>> >> >The MDISK is 100 cylinders but I want to expand it to 200
cylinders.
>>> >> >
>>> >> >How can I write the proper format on cylinders 99 to 199?
>>> >> >
>>> >> >The only way I found was to create another mdisk with 200
cylinders
>>> >> > and
>>> >> >format it, then DDR copy cyl 99 to 199 to my old disk.
>>> >> >There must be a better way.
>>> >> >
>>> >> >Does anyone know of a utility that will format specific
cylinders on
>>> >> > a
>>> >> disk?
>>> >> >
>>> >> >Thanks
>>> >> >
>>> >>
>>> >
>>
>>
>>
>> --
>>
>> Jonathan Quay
>>
>> Systems Engineer - Enterprise Servers and Virtualization
>>
>> Global Technology
>>
>>
>> Direct Line: 770-442-7026 <tel:770-442-7026>
>> Fax: 770-442-7191 <tel:770-442-7191>
>>
>> http://www.ihg.com <http://www.ihg.com/>
>>
>>
>
>
diff -wruN s390-tools-1.5.1/dasdfmt/dasdfmt.8 dasdfmt/dasdfmt.8
--- s390-tools-1.5.1/dasdfmt/dasdfmt.8 2011-06-27 16:54:55.000000000 -0500
+++ dasdfmt/dasdfmt.8 2006-03-29 11:37:34.000000000 -0600
@@ -9,6 +9,8 @@
[-b \fIblksize\fR] [-l \fIvolser\fR] [-d \fIlayout\fR]
.br
[-L] [-V] [-F] [-k] {-n \fIdevno\fR | -f \fInode\fR} \fIdevice\fR
+.br
+ [-s \fItrack\fR] [-e \fItrack\fR]
.SH DESCRIPTION
\fBdasdfmt\fR formats a DASD (ECKD) disk drive to prepare it
@@ -148,6 +150,26 @@
.br
.TP
+\fB-s\fR \fItrack\fR or \fB--start=\fR\fItrack\fR
+Start formatting at \fItrack\fR.
+.br
+
+.TP
+\fB-e\fR \fItrack\fR or \fB--end=\fR\fItrack\fR
+Stop formatting at \fItrack\fR. The track specified will also be formatted.
+.br
+
+.TP
+\fB-s\fR \fItrack\fR or \fB--start=\fR\fItrack\fR
+Start formatting at \fItrack\fR.
+.br
+
+.TP
+\fB-e\fR \fItrack\fR or \fB--end=\fR\fItrack\fR
+Stop formatting at \fItrack\fR. The track specified will also be formatted.
+.br
+
+.TP
\fB-n\fR \fIdevno\fR or \fB--devno=\fR\fIdevno\fR
Specify the device using the device number \fIdevno\fR. This device number is
a 4 character hexadecimal number WITHOUT prefixes. Leading zeros could be
omitted.
.br
diff -wruN s390-tools-1.5.1/dasdfmt/dasdfmt.c dasdfmt/dasdfmt.c
--- s390-tools-1.5.1/dasdfmt/dasdfmt.c 2011-06-27 16:54:55.000000000 -0500
+++ dasdfmt/dasdfmt.c 2009-04-08 14:29:03.000000000 -0500
@@ -16,6 +16,7 @@
#include "zt_common.h"
#include "dasdfmt.h"
#include "vtoc.h"
+#include <sys/time.h>
#include <sys/wait.h>
/* Full tool name */
@@ -43,17 +44,23 @@
" [-l <volser> | --label=<volser>]\n"
" [-b <blocksize> | --blocksize=<blocksize>]\n"
" [-d <disk layout> | --disk_layout=<disk
layout>]\n"
+ " [-s <track> | --start=<track>]\n"
+ " [-e <track> | --end=<track>]\n"
" <diskspec>\n\n",prog_name);
printf(" -t or --test means testmode\n"
+ " -c or --changeonly change disk layout only...no
formatting\n"
" -V or --version means print version\n"
" -L or --no_label means don't write disk label\n"
+ " -w x or --wait=x means wait x seconds at 1 percent
intervals\n"
+ " -s or --start means to start formatting at the
specified track\n"
+ " -e or --end means to stop formatting at (and including)
the specified track\n"
" -p or --progressbar means show a progress bar\n"
" -m x or --hashmarks=x means show a hashmark every x "
"cylinders\n"
" -v means verbose mode\n"
" -F means don't check if the device is in use\n"
- " -k means keep volume serial\n\n"
+ " -k means keep volume serial\n"
" <volser> is the volume identifier, which is converted\n"
" to EBCDIC and written to disk. \n"
" (6 characters, e.g. LNX001\n"
@@ -165,6 +172,7 @@
info->testmode = 0;
info->verbosity = 0;
info->withoutprompt = 0;
+ info->wait_seconds = 0;
info->print_progressbar = 0;
info->print_hashmarks = 0;
info->hashstep = 0;
@@ -177,6 +185,9 @@
info->devno_specified = 0;
info->device_id = 0;
info->keep_volser = 0;
+ info->start_track = -1;
+ info->end_track = -1;
+ info->change_only = 0;
}
@@ -570,10 +581,8 @@
if ((info->print_progressbar || info->print_hashmarks) &&
!info->yast_mode)
printf("\n");
- while (1) {
p1 = -1;
- p2 = 0;
-
+ while (1) {
format_step.start_unit = k;
format_step.stop_unit = k + drive_geo->heads - 1;
@@ -585,10 +594,18 @@
"BIODASDFMT failed. (%s)\n",
prog_name, strerror(errno));
- if (info->print_progressbar) {
- printf("cyl %5d of %5d |", cyl, drive_geo->cylinders);
p2 = p1;
p1 = cyl*100/drive_geo->cylinders;
+
+ if (info->wait_seconds > 0) {
+ if (p1 != p2)
+ {
+ sleep(info->wait_seconds);
+ }
+ }
+
+ if (info->print_progressbar) {
+ printf("cyl %5d of %5d |", cyl, drive_geo->cylinders);
if (p1 != p2)
{
/* percent value has changed */
@@ -701,6 +718,23 @@
p->start_unit = 0;
p->stop_unit = (drive_geo.cylinders * drive_geo.heads) - 1;
+ if (info->start_track != -1) {
+ if (info->start_track > p->stop_unit)
+ ERRMSG_EXIT(EXIT_FAILURE, "Starting track '%d' past
end of volume\n",
+ info->start_track);
+ p->start_unit = info->start_track;
+ }
+
+ if (info->end_track != -1) {
+ if (info->end_track < p->start_unit)
+ ERRMSG_EXIT(EXIT_FAILURE, "Ending track '%d' less than
starting track\n",
+ info->start_track);
+ if (info->end_track > p->stop_unit)
+ ERRMSG_EXIT(EXIT_FAILURE, "Ending track '%d' past end
of volume\n",
+ info->start_track);
+ p->stop_unit = info->end_track;
+ }
+
if (!info->writenolabel) {
if (!info->labelspec && !info->keep_volser) {
char buf[7];
@@ -857,6 +891,10 @@
}
break;
+ case 'w':
+ info.wait_seconds=atoi(optarg);
+ break;
+
case 'v':
info.verbosity=1;
break;
@@ -898,6 +936,20 @@
info.devno_specified=1;
break;
+ case 'c' :
+ info.start_track=0;
+ info.end_track=1;
+ info.change_only=1;
+ break;
+
+ case 's' :
+ info.start_track=atoi(optarg);
+ break;
+
+ case 'e' :
+ info.end_track=atoi(optarg);
+ break;
+
case 'f' :
if(dev_count>=MAX_DEVICES)
ERRMSG_EXIT(EXIT_MISUSE,"%s: too many devices
specified.\n",
diff -wruN s390-tools-1.5.1/dasdfmt/dasdfmt.h dasdfmt/dasdfmt.h
--- s390-tools-1.5.1/dasdfmt/dasdfmt.h 2011-06-27 16:54:55.000000000 -0500
+++ dasdfmt/dasdfmt.h 2009-04-08 13:55:15.000000000 -0500
@@ -149,17 +149,19 @@
if (*endptr) ERRMSG_EXIT(EXIT_MISUSE,"%s: " str " " \
"is in invalid format\n",prog_name);}
-#define dasdfmt_getopt_string "b:n:l:f:d:m:hpLty?vVFkYP:"
+#define dasdfmt_getopt_string "b:n:l:f:d:w:m:s:e:hpLty?cvVFkYP:"
static struct option dasdfmt_getopt_long_options[]=
{
{ "disk_layout", 1, 0, 'd'},
{ "test", 0, 0, 't'},
{ "version", 0, 0, 'V'},
+ { "changeonly", 0, 0, 'c'},
{ "no_label", 0, 0, 'L'},
{ "force", 0, 0, 'F'},
{ "progressbar", 0, 0, 'p'},
{ "hashmarks", 1, 0, 'm'},
+ { "wait", 1, 0, 'w'},
{ "label", 1, 0, 'l'},
{ "devno", 1, 0, 'n'},
{ "device", 1, 0, 'f'},
@@ -168,6 +170,8 @@
{ "max_parallel",1, 0, 'P'},
{ "yast_mode", 0, 0, 'Y'},
{ "keep_volser", 0, 0, 'k'},
+ { "start", 1, 0, 's'},
+ { "end", 1, 0, 'e'},
{0, 0, 0, 0}
};
@@ -194,6 +198,7 @@
int verbosity;
int testmode;
int withoutprompt;
+ int wait_seconds;
int print_progressbar;
int print_hashmarks, hashstep;
int force;
@@ -207,6 +212,9 @@
int keep_volser;
int yast_mode;
int procnum;
+ int start_track;
+ int end_track;
+ int change_only;
} dasdfmt_info_t;