Thanks Stefan, 
this is actually a path I was investigating today except that I took a slightly 
different approach. I have noticed that the Linux driver looks at the size of 
the first records on the track to check if it is any recognizable format. It 
checks if the key is 4 bytes long. So I accessed the device with 
raw_track_access and wrote the first track with a single record that had a key 
that was six bytes long. Brought it offline, switched off raw_track_access, 
brought it online again and got a nice "The DASD is not formatted" error in the 
syslog. The device was immediately ready for format.

The only thing that bothers me is the large number of I/O error messages in the 
syslog when you access the device in raw_track_access. We use the syslog for 
other errors as well, so I'm afraid of the log being rotated away too quickly. 
But if I remember right, I saw those errors even when running normal dasdfmt so 
this is nothing new.

Tomas

-----Original Message-----
From: Stefan Haberland [mailto:s...@linux.vnet.ibm.com] 
Sent: Wednesday, March 13, 2013 5:20 PM
To: Linux on 390 Port
Cc: Pavelka, Tomas
Subject: Re: DASD format from Linux only

Hi Tomas,

I have a possible solution for you from within Linux. You can set the device 
online with raw_track_access enabled.

$ echo 1 > /sys/bus/ccw/devices/0.0.XXXX/raw_track_access
$ chccwdev -e XXXX

Please ignore the few Buffer I/O errors in syslog.

Afterwards you can format the device using dasdfmt. It was not intended to do 
so but it works. Just checked on my system. Since the disk is in 
raw_track_access mode dasdfmt can not write the volume label to the disk.
So dasdfmt will fail with following error message:

Finished formatting the device.
dasdfmt: Writing the bootstrap IPL1 failed, only wrote -1 bytes.

But the disk is formatted correctly. When you set the disk online afterwards 
without raw_track_access you can call fdasd on the device. It will ask you if 
it should write the missing volume label to the disk.

$ fdasd /dev/dasde
reading volume label ..: no known label
Should I create a new one? (y/n): y

With this steps done the disk should be ready for usage.

Regards,
Stefan

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to