Saturday, September 28, 2013

A NAS with a Raspberry Pi: Part 1 - the drives

First, this isn't going to be linux standard.  I have constraints, 1)  NTFS formatted external drives, 2) only one partition per physical drive, and 3) a mixed OS network.


my steps:

1) upgrade everything first. optional, but it's my preference

sudo apt-get update && sudo apt-get upgrade && sudo reboot

2) install ntfs drivers.

sudo apt-get install ntfs-3g

3) find my external drive 

sudo fdisk -l

gives info including :

  Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    62333951    31105536   83  Linux

 

and 

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048  1953523711   976760832    7  HPFS/NTFS/exFAT


The last one is my external drive.  

4) find the serial for the drive

sudo udevadm info -a -q all -p $(udevadm info -q path -n /dev/sda1)
 

yields:

E: ID_SERIAL=ST31000528AS_9VP500HC

which becomes 

ENV{ID_SERIAL}="ST31000528AS_9VP500HC "

which is important, especially as I'm using two identical drive models. the serial the cleanest way to differentiate between them.


ls -l /dev/disk/by-uuid

gives (among others)

lrwxrwxrwx 1 root root 10 Jan  1  1970 7420568A205652EA -> ../../sda1
 



create "/home/81-external-drive1.rules"




copy it to /etc/udev/rules.d/81-external-drive1.rules

5) restart udev


sudo /etc/init.d/udev restart 

6) mnt/drive1 should exist and be browsable

7) reboot 

sudo reboot

8) should still be browsable 

9) repeat for drive2.

No comments:

Post a Comment