Copying disks with Linux

From Try-AS/400
Revision as of 12:43, 27 January 2022 by PoC (talk | contribs) (→‎Weblinks: +Link)
Jump to navigation Jump to search
Qsicon Fixme.png This article isn't finished yet or needs to be revised. Please keep in mind that thus it may be incomplete.

Reason: How to restore

PXE booted PC as SCSI Attachment Station

Since (mainly) older machines are very picky about Tape Drives, and existing tape drives either become defective, or working tape cartridges become more and more scarce, an alternative to regular full backups on tape is needed. Offline backups become more and more a viable alternative, despite the higher effort of (temporarily) extracting the disk(s) to hook them up to a SCSI equipped Linux PC.

IBM "blessed" AS/400 disks are different in some ways, which makes it difficult do cope with them on Linux. Fortunately, most problems can be avoided by using the SCSI Generic facilities to talk to the device(s) in question. For this, it's mandatory to have the sg3 utils package installed. In addition, the lsscsi package is also mandatory for checking devices on the bus from within Linux.

This article assumes basic knowledge about SCSI:

  • How to avoid duplicate device IDs,
  • proper bus (cable ends) termination.

Please see the articles in the See also section for further details.

Backup

  • Attach the disk and boot the PC,
  • use lsscsi -g to identify the disk(s) on the bus, and also list their SCSI Generic device node,
  • Duplicate the Disks's content with sg_dd (example):
sg_dd if=/dev/sg0 bs=522 of=outfile_522.dd

If is very important to know that (with some exceptions)

  • PowerPC based AS/400's use 522 Bytes per sector, and
  • CISC architecture AS/400's use 520 Bytes per sector.

If in doubt, use dmesg to scroll through the kernel message buffer and locate the position where the SCSI disk(s) is/are identified with their block size. It is important to use the correct blocksize in the bs= parameter.

Restore

First, make sure the new target disk has been formatted to the correct block size. The best way to do this is to IPL the target system via CD or tape, and use the DST provided utilities to do the formatting.

In theory, the dd statement from the backup just needs to be reversed to copy back the image file to the disk.

sg_dd if=outfile_522.dd bs=522 of=/dev/sg0

In practice, the copy command exits quickly with

31+1 records in
32+0 records out

Further investigation is necessary to provide a reliable way to copyback.

See also

Weblinks