# Patent

## Title
Live initialization of a boot device

## Abstract

Various embodiments of the present invention that include executing, by a processor, a software stack. A writeable boot device such as a storage device with a removable medium is detected, and a second software stack is saved by replacing, on the writeable boot device, a first boot image with a second boot image comprising a second software stack.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This Application is a Continuation of U.S. patent application Ser. No. 13/829,612, filed on Mar. 14, 2013, which is related to U.S. patent applications titled “Recovering From a Defective Boot Image”, “Self-Healing Using an Alternate Boot Partition”, “Self-Healing Using a Virtual Boot Device”, and “Rapid Booting of a Software Stack” filed on even date, and which are incorporated herein by reference.


FIELD OF THE INVENTION
The present invention relates generally to computer systems, and specifically to performing a live initialization or a live update of a boot device.
BACKGROUND
Operating systems manage the way software applications utilize the hardware of computer systems, such as storage controllers. A fundamental component of operating systems is the operating system kernel (also referred to herein as a “kernel”), which provides secure computer system hardware access to software applications executing on the computer system. Since accessing the hardware can be complex, kernels may implement a set of hardware abstractions to provide a clean and uniform interface to the underlying hardware. The abstractions provided by the kernel provide software developers easier access to the hardware when writing software applications.
Two common techniques for rebooting (i.e. restarting) an operating system are a “cold boot” and a “warm boot”. During a cold boot, power to a computer system's volatile memory is cycled (i.e., turned off and then turned on), and the operating system is rebooted. Since power is cut off to the memory, any contents (i.e., software applications and data) stored in the memory prior to the cold boot are lost. During a warm boot, the operating system reboots while power is still applied to the volatile memory, thereby enabling the computer to skip some hardware initializations and resets. Additionally, during a warm boot the memory may be reset.
In addition to a warm boot and a cold boot, the Linux operating system offers a method of rapidly booting a new operating system kernel via the kexec function. The kexec function first loads a new kernel into memory and then immediately starts executing the new kernel. Using kexec to boot a new kernel is referred to a “hot” reboot, since the computer's memory is not reset during the boot.
The description above is presented as a general overview of related art in this field and should not be construed as an admission that any of the information it contains constitutes prior art against the present patent application.
SUMMARY
There is provided, in accordance with an embodiment of the present invention a system for executing, by a processor, a software stack, comprising: a memory configured to store a first and a second software stack; and a processor configured to: execute the first software stack retrieved from a first boot image, retrieve and execute the second software stack, detect a writeable boot device, and save the second software stack by replacing, on the writeable boot device, the first boot image with a second boot image comprising the second software stack.
There is further provided, in accordance with an embodiment of the present invention a computer program product, the computer program product including a non-transitory computer readable storage medium having computer readable program code embodied therewith, the computer readable program code including computer readable program code configured to execute a first software stack retrieved from a first boot image; computer readable program code configured to retrieve and execute, by the processor, a second software stack; computer readable program code configured to detect a writeable boot device; and computer readable program code configured to save the second software stack by replacing, on the writeable boot device, the first boot image with a second boot image comprising the second software stack.



BRIEF DESCRIPTION OF THE DRAWINGS
The disclosure is herein described, by way of example only, with reference to the accompanying drawings, wherein:
FIG. 1 is a block diagram that schematically illustrates a storage system, in accordance with an embodiment of the present invention;
FIG. 2 is a block diagram of a module of the storage system configured to initialize a boot device, in accordance with an embodiment of the present invention;
FIG. 3 is a flow diagram that schematically illustrates a method of initializing a boot device, in accordance with an embodiment of the present invention;
FIG. 4 is a block diagram of a module of the storage system configured to update a boot image on the boot device, in accordance with an embodiment of the present invention; and
FIG. 5 is a flow diagram that schematically illustrates a method of updating a software stack and the boot image, in accordance with an embodiment of the present invention.



DETAILED DESCRIPTION OF EMBODIMENTS
In computing, a boot comprises an initial set of operations that a computer performs when electrical power is switched on (also referred to as power cycling). During a boot, a computer may load software components such as an operating system kernel, services and applications. For example, a service may comprise a process (also referred to as a daemon) configured to process input/output (I/O) requests, and an application may comprise configuration software that a user can execute on the computer. The software components that are loaded during a boot are typically stored in a system startup configuration file. For example, during a boot, a computer configured as a storage system may load a Linux operating system kernel, a network TCP/IP service and a storage application configured to process input/output (I/O) requests received from one or more host computers.
Software components that are loaded during a boot can be stored on a boot device as a boot image. When a computer system boots, the boot image is retrieved and stored in memory as a software stack. In other words, a loaded software stack may comprise an in-memory representation of a corresponding boot image on a boot device.
At a time subsequent to retrieving the boot image and executing the software stack, a computer may detect a failure or a “hiccup” (i.e., an intermittent hardware problem) in the boot device, and issue a notification to an operator. Upon receiving the notification, the operator can replace the failed boot device with a replacement writeable boot device that may not have a boot image (or a current boot image). Embodiments of the present invention provide methods and systems for initializing the replacement writeable boot device. In some embodiments, the software stack executing on the computer is saved as a boot image to the replacement boot device.
Additionally, there may be instances (e.g., in a production environment) when the computer is executing a first software stack, and a “hot” upgrade is then performed to upgrade one or more components of the software stack. The hot upgrade from a first software stack to a second (i.e., updated) software stack can be performed while the computer is in operation, without necessitating a physical reboot of the computer. Embodiments of the present invention provide methods and systems for replacing, on a boot device, a boot image comprising the first software stack with a boot image comprising the second software stack.
While the embodiments described herein relate generally to a storage system such as clustered storage controller, it will be understood that embodiments of the present invention may also be used, mutatis mutandis, for other types of computer systems.
FIG. 1 is a block diagram that schematically illustrates a data processing storage subsystem 20, in accordance with an embodiment of the invention. The particular subsystem (also referred to herein as a storage system) shown in FIG. 1 is presented to facilitate an explanation of the invention. However, as the skilled artisan will appreciate, the invention can be practiced using other computing environments, such as other storage subsystems with diverse architectures and capabilities.
Storage subsystem 20 receives, from one or more host computers 22, input/output (I/O) requests, which are commands to read or write data at logical addresses on logical volumes. Any number of host computers 22 are coupled to storage subsystem 20 by any means known in the art, for example, using a network. Herein, by way of example, host computers 22 and storage subsystem 20 are assumed to be coupled by a Storage Area Network (SAN) 26 incorporating data connections 24 and Host Bus Adapters (HBAs) 28. The logical addresses specify a range of data blocks within a logical volume, each block herein being assumed by way of example to contain 512 bytes. For example, a 10 KB data record used in a data processing application on a given host computer 22 would require 20 blocks, which the given host computer might specify as being stored at a logical address comprising blocks 1,000 through 1,019 of a logical volume. Storage subsystem 20 may operate in, or as, a SAN system.
Storage subsystem 20 comprises a clustered storage controller 34 coupled between SAN 26 and a private network 46 using data connections 30 and 44, respectively, and incorporating adapters 32 and 42, again respectively. In some configurations, adapters 32 and 42 may comprise host SAN adapters (HSAs). Clustered storage controller 34 implements clusters of storage modules 36, each of which includes an interface 38 (in communication between adapters 32 and 42), and a cache 40. Each storage module 36 is responsible for a number of storage devices 50 by way of a data connection 48 as shown.
As described previously, each storage module 36 further comprises a given cache 40. However, it will be appreciated that the number of caches 40 used in storage subsystem 20 and in conjunction with clustered storage controller 34 may be any convenient number. While all caches 40 in storage subsystem 20 may operate in substantially the same manner and comprise substantially similar elements, this is not a requirement. Each of the caches 40 may be approximately equal in size and is assumed to be coupled, by way of example, in a one-to-one correspondence with a set of physical storage devices 50, which may comprise disks. In one embodiment, physical storage devices may comprise such disks. Those skilled in the art will be able to adapt the description herein to caches of different sizes.
Each set of storage devices 50 comprises multiple slow and/or fast access time mass storage devices, herein below assumed to be multiple hard disks. FIG. 1 shows caches 40 coupled to respective sets of storage devices 50. In some configurations, the sets of storage devices 50 comprise one or more hard disks, which can have different performance characteristics. In response to an I/O command, a given cache 40, by way of example, may read or write data at addressable physical locations of a given storage device 50. In the embodiment shown in FIG. 1, caches 40 are able to exercise certain control functions over storage devices 50. These control functions may alternatively be realized by hardware devices such as disk controllers (not shown), which are linked to caches 40.
Each storage module 36 is operative to monitor its state, including the states of associated caches 40, and to transmit configuration information to other components of storage subsystem 20 for example, configuration changes that result in blocking intervals, or limit the rate at which I/O requests for the sets of physical storage are accepted.
Routing of commands and data from HBAs 28 to clustered storage controller 34 and to each cache 40 may be performed over a network and/or a switch. Herein, by way of example, HBAs 28 may be coupled to storage modules 36 by at least one switch (not shown) of SAN 26, which can be of any known type having a digital cross-connect function. Additionally, or alternatively, HBAs 28 may be coupled to storage modules 36.
In some embodiments, data having contiguous logical addresses can be distributed among modules 36, and within the storage devices in each of the modules. Alternatively, the data can be distributed using other algorithms, e.g., byte or block interleaving. In general, this increases bandwidth, for instance, by allowing a volume in a SAN or a file in network attached storage to be read from or written to more than one given storage device 50 at a time. However, this technique requires coordination among the various storage devices, and in practice may require complex provisions for any failure of the storage devices, and a strategy for dealing with error checking information, e.g., a technique for storing parity information relating to distributed data. Indeed, when logical unit partitions are distributed in sufficiently small granularity, data associated with a single logical unit may span all of the storage devices 50.
While such hardware is not explicitly shown for purposes of illustrative simplicity, clustered storage controller 34 may be adapted for implementation in conjunction with certain hardware, such as a rack mount system, a midplane, and/or a backplane. Indeed, private network 46 in one embodiment may be implemented using a backplane. Additional hardware such as the aforementioned switches, processors, controllers, memory devices, and the like may also be incorporated into clustered storage controller 34 and elsewhere within storage subsystem 20, again as the skilled artisan will appreciate. Further, a variety of software components, operating systems, firmware, and the like may be integrated into one storage subsystem 20.
Storage devices 50 may comprise a combination of high capacity hard disk drives and solid state disk drives. In some embodiments each of storage devices 50 may comprise a logical storage device. In storage systems implementing the Small Computer System Interface (SCSI) protocol, the logical storage devices may be referred to as logical units, or LUNs. While each LUN can be addressed as a single logical unit, the LUN may comprise a combination of high capacity hard disk drives and/or solid state disk drives.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
BOOT DEVICE INITIALIZATION
FIG. 2 is a block diagram of module 36 that is configured to initialize a boot device 60, in accordance with an embodiment of the present invention. Module 36 comprises a processor 62, a memory 64 and boot device 60. In embodiments of the present invention, boot device 60 comprises a writeable storage device such as a hard disk, an optical disk or a solid state drive (SSD). In some embodiments, boot device 60 may comprise a storage device with a removable medium, such as a CompactFlashTM device.
Boot device 60 stores a boot image 66, which comprises an initial set of components that processor 62 executes when power is cycled to module 36. In the example shown in FIG. 2, boot image 66 comprises a kernel 68, one or more services 70 and one or more applications 72. When booting module 36, processor 62 loads boot image 66 to a software stack 74 in memory 64, and starts executing kernel 68, services 70 and applications 72 from the software stack in the memory.
Processor 62 typically comprises a general-purpose computer, which is programmed in software to carry out the functions described herein. The software may be downloaded to module 36 in electronic form, over a network, for example, or it may be provided on non-transitory tangible media, such as optical, magnetic or electronic memory media. Alternatively, some or all of the functions of processor 62 may be carried out by dedicated or programmable digital hardware components, or using a combination of hardware and software elements.
While the embodiments describe herein have software stack 74 comprising kernel 68, services 70 and applications 72, any organized collection comprising any number of components in memory 64 is considered to be within the spirit and scope of the present invention. For example, the collection (e.g., software stack 74) may comprise only kernel 72.
FIG. 3 is a flow diagram that schematically illustrates a method of initializing boot device 60, in accordance with an embodiment of the present invention. In a first detection step 80, processor 62 detects a failure of boot device 60 (or a “hiccup”, as described supra), and in a notification step 82, the processor conveys a message to given host computer 22 in order to notify an operator (not shown) of the failure. In some embodiments, processor 62 conveys an alert or initiates an event that results in a service notification being issued.
After receiving the notification, the operator (or a technician) can replace the failed boot device with a replacement boot device 60, which typically comprises a blank storage medium. In a second detection step 84, processor 62 detects a functioning boot device 60 (e.g., a replacement functional CF card) that does not have a boot image. Finally, in a save step 86, processor 62 saves software stack 74 to boot image 66 on boot device 60, and the method ends. In some embodiments, for example when boot device 60 has a slow data transfer rate, processor 62 may compress software stack 74, and save the compressed software stack to boot image 66.
BOOT IMAGE UPDATE
FIG. 4 is a block diagram of module 36 configured to update boot image 66 on boot device 60, in accordance with an embodiment of the present invention. In the description herein, boot images 66, software stacks 74 and their respective software components may be differentiated by appending a letter to the identifying numeral, so that boot images 66 comprise a first boot image 66A and a second boot image 66B, and software stacks 74 comprise a first software stack 74A and a second software stack 74B.
In the example shown in FIG. 4, processor 62 initially loads first boot image 66A and executes first software stack 74A. Kernel 68B, services 70B and applications 72B comprise updated versions of kernel 68A, services 70A and applications 72A respectively, and are stored on storage device 50. As described hereinbelow, processor 62 can update boot image 66 by first loading kernel 68B, services 70B and applications 72B from storage device 50 to memory 64, so that second software stack 74B comprises kernel 68B, services 70B and applications 72B. In some embodiments, processor replaces, in memory 64, software stack 74A with software stack 74B (i.e., at the same location in memory).
Upon loading second software stack 74B, Processor 62 can then transfer operation from first software stack 74A to second software stack 74B. Upon processor 62 detecting that second software stack 74B is executing correctly, the processor can then replace the first software stack with the second software stack on boot device 60, as indicated by an arrow 76.
While the embodiments describe herein have processor 62 updating all components (i.e., kernel 68, services 70 and applications 72) of software stack 74, updating any number of components in the software stack and the boot device is considered to be within the spirit and scope of the present invention. For example, the only component upgraded in software stack 74 may comprise kernel 68.
FIG. 5 is a flow diagram that schematically illustrates a method of updating software stack 74 and boot image 66, in accordance with an embodiment of the present invention. As described supra, processor 62 is initially executing components of first software stack 74A that were retrieved from first boot image 66A.
In a load step 90, processor 62 retrieves boot image 66B from storage device 50, thereby loading kernel 68B, services 70B and applications 72B to second software stack 74. In a boot step 92, processor 62 calls the kexec function which first overwrites kernel 68A with kernel 68B and then starts executing (i.e., boots) kernel 68B. After booting kernel 68B, processor 62 starts executing services 70B and applications 72B in a start step 94.
In a comparison step 96, if second software stack 74B reaches a boot level threshold (e.g., when certain services and/or applications have been successfully loaded), then in a replacement step 98, processor 62 replaces, on boot device 60, first boot image 66A with second boot image 66B that comprises second software stack 74B, and the method ends. If processor 62 detects that second software stack 74B fails to reach the boot level threshold (i.e., within a specified time period, or if one of the components on the second software stack fails), then in a reboot step 100, the processor power cycles module 36 to reboot the module using first boot image 66A.
For example, to detect the failure to reach the boot level threshold (i.e., detecting a failure), Processor 62 may detect a failure when executing software stack 74B (i.e., a new software stack) and takes recovery action, due to an event such as a corrupted image (i.e. in kernel 68B, services 70B, or application 72B) on storage device 50, or an execution error in one of the components in the second software stack.
In some instances, processor 62 may reboot module 36 if the processor fails to reach a boot threshold within a timeout (e.g., something happened that prevented the module from successfully transitioning to execute the second software stack). Methods of rebooting module 36 include but are not limited to:

    
    
        The module may include a hardware watchdog timer (not shown) that can power cycle the module (or the storage controller) upon the second software stack failing to reach the boot level threshold within a specified time period (i.e., the timer can be canceled upon the module reaching the defined boot threshold, within the specified time period). The hardware watchdog may comprise an independent processor that is configured to power cycle the unit if the timer is not reset.
        The processor can configure other modules 36 in the storage controller to power cycle a given module 36 if the given module fails to communicate a “good” status within a defined time period (i.e., a “timeout”).
    
    


The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the Figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or actions, or combinations of special purpose hardware and computer instructions.
It will be appreciated that the embodiments described above are cited by way of example, and that the present invention is not limited to what has been particularly shown and described hereinabove. Rather, the scope of the present invention includes both combinations and subcombinations of the various features described hereinabove, as well as variations and modifications thereof which would occur to persons skilled in the art upon reading the foregoing description and which are not disclosed in the prior art.

## Claims

1. A storage system, comprising:
a memory configured to store a first and a second software stack; and
a processor configured to:
execute the first software stack retrieved from a first boot image,
retrieve and execute the second software stack,
detect a writeable boot device, and
save the second software stack by replacing, on the writeable boot device, the first boot image with a second boot image comprising the second software stack.

2. The storage system according to claim 1, wherein the processor is configured to save, upon reaching a boot level threshold for the second software stack, the second software stack to the writeable boot device as a second boot image.

3. The storage system according to claim 1, wherein the first or second software stack comprises one or more components that the processor is configured to select from a list comprising an operating system kernel, a service, and a software application.

4. The storage system according to claim 1, wherein the processor is configured to select the boot device from a list comprising a solid state drive, a hard disk and an optical disk.

5. The storage system according to claim 1, wherein the processor is configured to save the second software stack upon detecting the boot device having no boot image.

6. The storage system according to claim 1, wherein the processor is configured to reboot the first software stack upon the second software stack failing to reach a boot level threshold for the second software stack.

7. The storage system according to claim 6, and comprising a timer configured to power cycle the storage system upon the second software stack failing to reach the boot level threshold for the second software stack within a specific time period.

8. The storage system according to claim 1, wherein the processor is configured to execute the first software stack from a location in a memory, and wherein the processor is configured to execute the second software stack by replacing, in the memory location, the first software stack with the second software stack.

9. A computer program product, the computer program product comprising:
a non-transitory computer readable storage medium having computer readable program code embodied therewith, the computer readable program code comprising:
computer readable program code configured to execute a first software stack retrieved from a first boot image;
computer readable program code configured to retrieve and execute, by the processor, a second software stack;
computer readable program code configured to detect a writeable boot device; and
computer readable program code configured to save the second software stack by replacing, on the writeable boot device, the first boot image with a second boot image comprising the second software stack.

10. The computer program product according to claim 9, wherein the computer readable program code is further configured to save, upon reaching a boot level threshold for the second software stack, the second software stack to the writeable boot device as a boot image.

11. The computer program product according to claim 9, wherein the computer readable program code is further configured to save the first or second software stack upon detecting the boot device having no boot image.

12. The computer program product according to claim 9, wherein the computer readable program code is further configured to reboot the first software stack upon the second software stack failing to reach a boot level threshold for the second software stack.