Combining a badblock scan with a time output. Ultimate goal: Encrypting a nonOS drive


Results 1 to 4 of 4

Thread: Combining a badblock scan with a time output. Ultimate goal: Encrypting a nonOS drive

  1. #1
    Join Date
    Feb 2005
    Posts
    11

    Question Combining a badblock scan with a time output. Ultimate goal: Encrypting a nonOS drive

    I have a Lenny Raid-5 setup, and I use rsnapshot to occasionally backup the raid to an old external hard drive that I otherwise leave unplugged. That external went bad, so I figured I should setup its replacement with encryption and keep it off site when not in use.

    While googling and coming across LUKS, I can across this post this post that mentioned the drive should be be filled with random data before setting it up for encryption, and had the following as a potential sufficiently-good option over the time-intensive dd /dev/random route:
    badblocks -c 10240 -s -w -t random -v /dev/sdx

    I was unfamiliar with badblocks, and came across this post after a google session which noted the time duration of scan is an important factor as well as the result.

    I sshed into the NAS, and was about to run badblocks first in read mode, then in write mode, but then I considered the time consideration. I was going to use something similar to the following:
    nohup badblocksstuff &

    My Question: Is there a way I can append to the resulting nohup.out a time to complete value? Thanks!

    DrCR

  2. #2
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,936
    Hmm. I think I understand the question; we'll see.

    I think you can do this with something like:

    nohup sh -c "badblocks stuff ; date" &

    This runs "badblocks stuff", and then runs "date", both inside the same shell ("sh -c"), which is under nohup and run in the background, so the output goes to nohup.out.

    You need the "sh -c" because you need the quotes; otherwise the shell thinks the semicolon is referring to the nohup command, and it runs "date" in the background, after nohup finishes (and doesn't give you a prompt until nohup does finish).

    You *might* be able to just escape the semicolon and get it to work; I don't know how nohup does its command line parsing. ("nohup badblocks stuff \; date &") But that might fail spectacularly.

  3. #3
    Join Date
    Jul 2001
    Location
    Fife, Scotland
    Posts
    1,794
    I don't use badblocks, but I do use encryption. It's dead easy on Lenny since there's a command for generating the keys (AES256 v3 - 65 different keys) and you can pipe the output of dd through aespipe to encrypt it onto the drive.

    For further protection, I have a Windows XP install on /dev/hda1 in a 40GB partition, but the rest of the system (40GB Linux, 80GB storage space) is encrypted without using a partition table. This means that the start of the actual boot drive cannot be found and neither can the storage partition. The Linux system boots off a USB key whilst Windows boots off the hard drive. Anyone who wants to start this machine is faced with a fully working (and licenced) copy of XP Professional and no indication that Linux is even there.

    James
    -----------------------------
    UseLinux.net
    -----------------------------

    perl -e 'use Math::Complex;$|=1;for$r(0..24){for$c (0..79){$C=cplx(($c/20.0)-3.0,-($r/12.0)+1.0);$Z= cplx(0,0);for($i=0;($i<80)&&(abs($Z)<2.0);$i++){$Z =$Z*$Z+$C;}print$i>=80?"*":" ";}print"\n";}'

  4. #4
    Join Date
    Feb 2005
    Posts
    11
    Quote Originally Posted by bwkaz View Post
    nohup sh -c "badblocks stuff ; date" &
    I used something like this. You're going to laugh at what happened though. nohup saved the standard out to a text file. Unfortunatly the output file got so large that it filled up the 5GB free on the OS HDD and halted the scan.

    Just wanted to post a follow up (at long last). A friend of mine recommended screen. I'm going to be googling for a tutorial on it.


    James - that's quite an intriguing setup. You got a tutorial somewhere?

    Thanks,
    DrCR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •