On Fri, 30 Mar 2012 13:14:37 -0400 (EDT), Mark Post wrote: > > On 3/30/2012 at 07:28 AM, Stephen Powell <zlinux...@wowway.com> wrote: >> >> Try issuing the command again, this time without "ext2" specified at the >> end. >> i.e. >> >> resize 1 98.3kb 2462MB > > parted is not going to work with ECKD devices, period.
That's not true. parted does have support for resizing partitions on ECKD devices, as long as the disk is formatted in cdl layout. The problem is that if it recognizes a file system on the partition that it is resizing, it tries to resize the file system too; and that seldom works because the file system code doesn't support file system options that are usually in effect these days. The ext2 file system options supported by parted for the resize operation are as follows: has_journal dir_index filetype sparse_super large_file If other options are in effect, such as ext_attr or resize_inode for example, parted will fail the entire operation. However, the "rm" and "mkpart" commands of parted, followed by the resize2fs command, can accomplish the same thing. I tested this on my system. Here is a sample console session. Note that I took the device offline and brought it back online a number of times. I don't know if all of those sequences were necessary, but I threw them in for good measure. It forces a flush of buffers when going offline, and forces the kernel to re-read certain things when coming back online. Note that, in theory, fdasd could be used, rather than parted, to create, delete, then re-create the partition at a larger size, provided that fdasd doesn't write anything to the partition when it deletes it. I don't know enough about fdasd to know if that is the case. The old MSDOS fdisk program was known to write out a few blocks of binary zeros to the beginning of a partition when it deleted it. This, of course, destroys the usability of the data in the partition. I know that parted does not do this. Also note that I manipulated the partition table in logical sectors (unit s), which is 512 bytes. There are eight logical sectors for each 4K physical block. ----- debian3:~# cat /proc/dasd/devices 0.0.0200(DIAG) at ( 94: 0) is dasda : active at blocksize: 4096, 600840 blocks, 2347 MB 0.0.0203(DIAG) at ( 94: 4) is dasdb : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0202(DIAG) at ( 94: 8) is dasdc : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0201(ECKD) at ( 94: 12) is dasdd : active at blocksize: 4096, 13500 blocks, 52 MB debian3:~# vmcp DEFINE T3390 0204 2 DASD 0204 DEFINED echo 1 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# cat /proc/dasd/devices 0.0.0200(DIAG) at ( 94: 0) is dasda : active at blocksize: 4096, 600840 blocks, 2347 MB 0.0.0203(DIAG) at ( 94: 4) is dasdb : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0202(DIAG) at ( 94: 8) is dasdc : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0201(ECKD) at ( 94: 12) is dasdd : active at blocksize: 4096, 13500 blocks, 52 MB 0.0.0204(ECKD) at ( 94: 16) is dasde : unformatted debian3:~# dasdfmt -b 4096 -l DEB204 -d cdl /dev/dasde Drive Geometry: 2 Cylinders * 15 Heads = 30 Tracks I am going to format the device /dev/dasde in the following way: Device number of device : 0x204 Labelling device : yes Disk label : VOL1 Disk identifier : DEB204 Extent start (trk no) : 0 Extent end (trk no) : 29 Compatible Disk Layout : yes Blocksize : 4096 --->> ATTENTION! <<--- All data of that device will be lost. Type "yes" to continue, no will leave the disk untouched: yes Formatting the device. This may take a while (get yourself a coffee). Finished formatting the device. Rereading the partition table... ok debian3:~# cat /proc/dasd/devices 0.0.0200(DIAG) at ( 94: 0) is dasda : active at blocksize: 4096, 600840 blocks, 2347 MB 0.0.0203(DIAG) at ( 94: 4) is dasdb : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0202(DIAG) at ( 94: 8) is dasdc : active at blocksize: 4096, 90000 blocks, 351 MB 0.0.0201(ECKD) at ( 94: 12) is dasdd : active at blocksize: 4096, 13500 blocks, 52 MB 0.0.0204(ECKD) at ( 94: 16) is dasde : active at blocksize: 4096, 360 blocks, 1 MB debian3:~# parted /dev/dasde unit s print free Model: IBM S390 DASD drive (dasd) Disk /dev/dasde: 2880s Sector size (logical/physical): 512B/4096B Partition Table: dasd Number Start End Size File system Flags 192s 2879s 2688s Free Space debian3:~# parted /dev/dasde unit s mkpart 192 1439 Information: You may need to update /etc/fstab. debian3:~# echo 0 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# echo 1 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# parted /dev/dasde unit s print free Model: IBM S390 DASD drive (dasd) Disk /dev/dasde: 2880s Sector size (logical/physical): 512B/4096B Partition Table: dasd Number Start End Size File system Flags 1 192s 1439s 1248s lvm 1440s 2879s 1440s Free Space debian3:~# mke2fs -L DEB204A -t ext2 /dev/dasde1 mke2fs 1.42.1 (17-Feb-2012) Filesystem label=DEB204A OS type: Linux Block size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 96 inodes, 156 blocks 7 blocks (4.49%) reserved for the super user First data block=0 1 block group 32768 blocks per group, 32768 fragments per group 96 inodes per group Allocating group tables: done Writing inode tables: done Writing superblocks and filesystem accounting information: done debian3:~# echo 0 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# echo 1 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# parted /dev/dasde unit s print free Model: IBM S390 DASD drive (dasd) Disk /dev/dasde: 2880s Sector size (logical/physical): 512B/4096B Partition Table: dasd Number Start End Size File system Flags 1 192s 1439s 1248s ext2 1440s 2879s 1440s Free Space debian3:~# mount /dev/dasde1 /mnt debian3:~# echo It\ works\! >/mnt/test.txt debian3:~# cat /mnt/test.txt It works! debian3:~# umount /mnt debian3:~# parted /dev/dasde unit s rm 1 Information: You may need to update /etc/fstab. debian3:~# parted /dev/dasde unit s mkpart 192 2879 Information: You may need to update /etc/fstab. debian3:~# echo 0 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# echo 1 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# parted /dev/dasde unit s print free Model: IBM S390 DASD drive (dasd) Disk /dev/dasde: 2880s Sector size (logical/physical): 512B/4096B Partition Table: dasd Number Start End Size File system Flags 1 192s 2879s 2688s ext2 debian3:~# resize2fs /dev/dasde1 resize2fs 1.42.1 (17-Feb-2012) Resizing the filesystem on /dev/dasde1 to 336 (4k) blocks. The filesystem on /dev/dasde1 is now 336 blocks long. debian3:~# echo 0 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# echo 1 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# mount /dev/dasde1 /mnt debian3:~# cat /mnt/test.txt It works! debian3:~# umount /mnt debian3:~# echo 0 >/sys/bus/ccw/devices/0.0.0204/online debian3:~# vmcp DETACH VIRTUAL 0204 DASD 0204 DETACHED debian3:~# ----- -- .''`. Stephen Powell : :' : `. `'` `- ---------------------------------------------------------------------- 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/