How to properly remove disk from PERC 6/i RAID controller?

90

Putting that spare disk in your drawer doesn't make too much sense. Instead, leave it in the server and mark it as a hot spare. Instructions here. Then, you'll have a OS mirror and a RAID5 array for data and if any of those disks fails, the controller will automatically rebuild with the hot spare.

As for why you are getting an error about the last disk, you'll have to provide more detail. What is the error? Have you already rebuilt all of the RAID sets so that disk is not currently configured in a RAID set?

Share:
90

Related videos on Youtube

user1681039
Author by

user1681039

Updated on September 17, 2022

Comments

  • user1681039
    user1681039 almost 2 years

    I want to delete a row from the database depending on what the file name of the image is. Lets say I have 2 tables below:

    Image Table:
    
    ImageId  ImageFile
    
    01       cat.png
    02       dog.png
    03       dog_2.png
    
    Image_Question Table:
    
    ImageId   SessionId   QuestionId
    01        AAA              4
    02        ABD              1
    03        RTD              11
    

    Lets say in my application I delete the file image dog_2.png, then I want it to delete the row which states dog_2.png in the Image Table (This is working fine) and be able to delete the row from the Image_Question Table where the row contains the same ImageId associated with the ImageId and ImageFile name from the Image Table (This is not working).

    So for the above example the 2 tables should now look like this after deletion:

    Image Table:
    
    ImageId  ImageFile
    
    01       cat.png
    02       dog.png
    
    Image_Question Table:
    
    ImageId   SessionId   QuestionId
    01        AAA              4
    02        ABD              1
    

    But it does not delete the row from the Image_Question Table, how can I get this row to delete?

    Below is the full code where it deletes the row from the Image Table and it contains most of the code which has been setup but not fully completed on deleting a row from the Image_Question Table:

    $image_file_name = $_GET["imagefilename"];
    $img = "ImageFiles/$image_file_name";
    
    echo "$image_file_name was Deleted";
    unlink("ImageFiles/$image_file_name");
    
    $imagedeletesql = "DELETE FROM Image WHERE ImageFile = ?";
    
    if (!$delete = $mysqli->prepare($imagedeletesql)) {
        // Handle errors with prepare operation here
    }
    
    //Don't pass data directly to bind_param; store it in a variable
    $delete->bind_param("s",$img);
    
    $delete->execute();
    
    if ($delete->errno) {
        // Handle query error here
    }
    
    $delete->close();
    
    $imagequestiondeletesql = "DELETE FROM Image_Question WHERE ImageId = ?";
    
    if (!$deleteimagequestion = $mysqli->prepare($imagequestiondeletesql)) {
        // Handle errors with prepare operation here
    }
    
    // Don't pass data directly to bind_param; store it in a variable
    $deleteimagequestion->bind_param("s",....);
    
    $deleteimagequestion->execute();
    
    if ($deleteimagequestion->errno) {
        // Handle query error here
    }
    
    $deleteimagequestion->close();  
    
    • ruakh
      ruakh almost 12 years
      Which storage engine are you using? If you're using InnoDB, you can add a foreign key with ON DELETE CASCADE (see dev.mysql.com/doc/refman/5.1/en/…), which would remove the need for you to handle this in application code.
    • user1681039
      user1681039 almost 12 years
      I don't know which storage engine it is but can you show me in your answer what the code should look like if I need to use DELETE CASCADE?
    • ruakh
      ruakh almost 12 years
      If you have InnoDB, and add a foreign key with ON DELETE CONSTRAINT, then you could just remove all the PHP code that deletes the records from Image_Question, because as soon as you deleted a record from Image, all of its child-records would instantly be deleted as well.
    • user1681039
      user1681039 almost 12 years
      So should the code in SQL (phpmyadmin) be: ALTER TABLE Image_Question ADD FOREIGN KEY('ImageId') REFERENCES Image('ImageId') ON DELETE CASCADE ?
    • ruakh
      ruakh almost 12 years
      Yes, exactly, except that I'm not sure about the single-quotes around ImageId. Backticks would be better, IMHO.
    • user1681039
      user1681039 almost 12 years
      @ruakh I put the code in SQL (without the single quotes) and it accepted the code. But when I delete the row from the Image Table, it still doesn't delete the row from the Image_Question table, do I need to inclde the ON DELETE CASCADE code in the php as well?
    • ruakh
      ruakh almost 12 years
      That probably just means that you're not using InnoDB. The other MySQL storage engines, such as MyISAM, don't support foreign keys. :-/
  • Stefano Borini
    Stefano Borini over 14 years
    I see two problems with the hot spare. The first is that it makes the setup too complex for the environment I'm in (if someone has to put the hands on the server). The second is that I want effectively a cold spare to prevent any type of stress (electric or mechanic) on it. I am rebuilding the array right now. It claims "E1812" on the display, about the missing disk. I assume it's probably a good idea to go for a hot spare as you said, but I've never used this kind of medium irons, so I am quite improvising here. Any more hint very welcome on this regard.
  • Return_Of_The_Archons
    Return_Of_The_Archons over 14 years
    Yeah, you're overthinking this. Hot spares are good. Cold spares are bad. Take icky2000's advice and mark your extra drive as a hot spare. It's a simple configuration, far simpler than expecting someone unfamiliar with your config to get the RAID array to properly rebuild onto a new drive. Then when a drive does fail, they have an immediate safety net until they can figure out how to replace a drive.
  • learnningprogramming
    learnningprogramming over 14 years
    E1812 is an information only "error" - just means no disk is there. Just rebuild the RAID set without it, acknowledge the "alert" and proceed. I understand that you don't have experience with server hardware but you're shooting down good advice with reasons that don't make sense. Put the disk back in and make it a hot spare.
  • user1681039
    user1681039 almost 12 years
    I want to use bind_params in mysqli because it is safer, does that mean the code is like this: DELETE Image, Image_Question FROM Image INNER JOIN Image_Question WHERE Image.ImageId= ? AND Image.ImageFile = ?; ... $delete->bind_param("ss",Image_Question.ImageId ,$img);