Showing posts with label repair. Show all posts
Showing posts with label repair. Show all posts

Friday, 20 April 2012

Undoing a Rails generate

To undo an action in Rails (generation of a scaffold, model, migration, etc), you can use
 rails destroy  

For example, generating and then destroying a controller called Posts would look like this:

 $ rails generate controller Posts  
    create app/controllers/posts_controller.rb  
    invoke erb  
    create  app/views/posts  
    invoke test_unit  
    create  test/functional/posts_controller_test.rb  
    invoke helper  
    create  app/helpers/posts_helper.rb  
    invoke  test_unit  
    create   test/unit/helpers/posts_helper_test.rb  
    invoke assets  
    invoke  coffee  
    create   app/assets/javascripts/posts.js.coffee  
    invoke  scss  
    create   app/assets/stylesheets/posts.css.scss  

$ rails destroy controller Posts  
    remove app/controllers/posts_controller.rb  
    invoke erb  
    remove  app/views/posts  
    invoke test_unit  
    remove  test/functional/posts_controller_test.rb  
    invoke helper  
    remove  app/helpers/posts_helper.rb  
    invoke  test_unit  
    remove   test/unit/helpers/posts_helper_test.rb  
    invoke assets  
    invoke  coffee  
    remove   app/assets/javascripts/posts.js.coffee  
    invoke  scss  
    remove   app/assets/stylesheets/posts.css.scss  

Thursday, 9 February 2012

Cloning a Laptop Drive

I recently had cause to replace a laptop hard drive, cloning the contents to avoid having to reinstall all the software on it. Here is a list of the tools used and steps taken:

  1. Clone drive to external USB hard disk using EaseUS® Todo Backup Free 4.0*
  2. Remove old hard drive from laptop and replace with new one.
  3. Clone old drive image from USB to new laptop hard drive using  EaseUS® Todo Backup Free 4.0 (bootable disk).
  4. Boot from Windows install CD and run system repair to fix master boot record (lost as it can't be sector cloned to USB hard drives).
  5. Boot from new hard drive into Windows.
  6. Run chkdsk /r to verify and repair new disk and file system.



* I actually used CloneZilla for this step, as I hadn't yet discovered EaseUS Todo Backup. Image based clones were failing due to the old hard drive physically failing, so a sector-sector clone was completed. CloneZilla could not restore this sector-sector image back from the intermediate drive as it wouldn't clone a 1TB drive back to a 500GB drive (I couldn't find a way to sector clone just the portioned areas of the external drive). EaseUS Todo Backup happily restored only the required partitions back to the new 500GB drive.