GreenStar

From Oh Mad Lab
Jump to navigation Jump to search

Power Saving External Hard Drive

I purchased the following:

Preparing

I tried formating in Windows with ntfs, but the drive kept powering off. I guess it the way Windows formats. With a quick format I was able to get it working though. I soon realized that I rather have the drive formated as ext2 for great NAS justice via my Linksys WRTSL54GS router. Here are the steps I took in nix:

  • Plugged in the USB drive and ran dmesg to find out which port it was on, which was sdf.
dmesg
[172017.336000] usb 2-7: new high speed USB device using ehci_hcd and address 7
[172023.184000] usb 2-7: new high speed USB device using ehci_hcd and address 8
[172024.016000] usb 2-7: new high speed USB device using ehci_hcd and address 9
[172024.128000] usb 2-7: device descriptor read/64, error -71
[172024.364000] usb 2-7: configuration #1 chosen from 1 choice
[172024.364000] scsi7 : SCSI emulation for USB Mass Storage devices
[172024.364000] usb-storage: device found at 9
[172024.364000] usb-storage: waiting for device to settle before scanning
[172029.364000] usb-storage: device scan complete
[172029.364000] scsi 7:0:0:0: Direct-Access     ST375033 0AS                   PQ: 0 ANSI: 2 CCS
[172029.368000] sd 7:0:0:0: [sdf] 1465149168 512-byte hardware sectors (750156 MB)
[172029.368000] sd 7:0:0:0: [sdf] Write Protect is off
[172029.368000] sd 7:0:0:0: [sdf] Mode Sense: 00 38 00 00
[172029.368000] sd 7:0:0:0: [sdf] Assuming drive cache: write through
[172029.372000] sd 7:0:0:0: [sdf] 1465149168 512-byte hardware sectors (750156 MB)
[172029.372000] sd 7:0:0:0: [sdf] Write Protect is off
[172029.372000] sd 7:0:0:0: [sdf] Mode Sense: 00 38 00 00
[172029.372000] sd 7:0:0:0: [sdf] Assuming drive cache: write through
[172033.624000] usb 2-7: reset high speed USB device using ehci_hcd and address 9
[172041.216000] sd 7:0:0:0: [sdf] Attached SCSI disk
[172041.216000] sd 7:0:0:0: Attached scsi generic sg6 type 0
  • cfdisk /dev/sdf - Deleted the ntfs partition and created a new linux partition.
                          cfdisk (util-linux-ng 2.13)

                              Disk Drive: /dev/sdf
                       Size: 750156374016 bytes, 750.1 GB
             Heads: 255   Sectors per Track: 63   Cylinders: 91201

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    sdf1                    Primary   Linux                           750153.77 
  • I ran mkfs to create the file system (format).
mkfs -t ext3 /dev/sdf1
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
91586560 inodes, 183143000 blocks
9157150 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
5590 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

  • To be extra safe, I ran a file system check.
fsck -f -y /dev/sdf1
fsck 1.40.2 (12-Jul-2007)
e2fsck 1.40.2 (12-Jul-2007)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdf1: 11/91586560 files (9.1% non-contiguous), 2924518/183143000 blocks


  • Since I have journaling (ext3), I don't need excessive system checks and I'm concerned with the fact that the USB HD will be powering off to save electricity, wear/tear, heat generation, etc.. I'm not certain how this will react with the forced fsck, so I'll turn it off and manually run them at my leisure. Likewise, I added the "-m 1" to set the reserved blocks to 1% as that's more of a sane percentage for today's large drives.
tune2fs -c 0 -i 0 -m 1 /dev/sdf1 
tune2fs 1.40.2 (12-Jul-2007)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

Using

  • sudo mkdir /mnt/titan/
  • sudo mount /dev/sdf1 /mnt/titan/
  • df -h /mnt/titan/
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdf1             688G  198M  653G   1% /mnt/titan

Greenstar usb hd.jpg


Links