Difference between revisions of "Adding a second hard drive to your HDA"

From Amahi Wiki
Jump to: navigation, search
m (corrected misspelled word and corrected grammar)
Line 2: Line 2:
  
 
* This is an '''advanced''' howto on how to add a drive to your HDA
 
* This is an '''advanced''' howto on how to add a drive to your HDA
* This page may need a refresh to make sure it matches the new script called hda-diskmount, based on the old script. Please edit this page if as you walk through you find issues
+
* This page may need a refresh to make sure it matches the new script called hda-diskmount, based on the old script. Please edit this page if you find any issues that need to be corrected
* Amahi cannot be held responsible for any data breakage or descrution arising from the use or misuse of this script. We provide it as a service in good will. You accept this automatically if you use the script
+
* Amahi cannot be held responsible for any data breakage or destruction arising from the use or misuse of this script. We provide it as a service in good will. You accept this automatically if you use the script
  
 
=Quickstart=
 
=Quickstart=

Revision as of 10:55, 10 February 2010

IMPORTANT NOTES:

  • This is an advanced howto on how to add a drive to your HDA
  • This page may need a refresh to make sure it matches the new script called hda-diskmount, based on the old script. Please edit this page if you find any issues that need to be corrected
  • Amahi cannot be held responsible for any data breakage or destruction arising from the use or misuse of this script. We provide it as a service in good will. You accept this automatically if you use the script

Quickstart

A secondary hard drive (fat32, ntfs, etc) can be added for additional storage in your Amahi HDA.

First thing's first, make sure your drive is detected by the BIOS, connected properly and formatted properly. Once the BIOS sees it, you need to have it partitioned.

You can check this with the following command (run before and after connecting the (USB) disk):

        dmesg

You'll see something along the lines of

        USB Mass Storage device found at ...

followed by a line with a /dev/sd<x> device.

  • run the diskmounter script: root@localhost # hda-diskmount
    Answer "yes" to the prompt to make the drive world writable.
  • install pmount if you get an error: root@localhost # yum -y install pmount
  • try to run the script again: root@localhost # hda-diskmount
  • reboot
  • check your /etc/fstab how the disk is mounted: root@localhost # cat /etc/fstab (it will usually be the last line that's added). Edit it to where you want to mount it.

Complete walkthrough

Your new drive can be configured to mount permanently using the hda-diskmounter script (thanks to Dennis Kaarsemaker and Luigi Capriotti). You can use this for adding a new fixed (internal) disk or an external USB/FireWire disk.

  • Make sure you have pmount installed: yum -y install pmount
  • Execute the script as root and answer YES to the prompt to make the drive writable to all users.
  • Once complete, reboot and the secondary drive should automatically mount.
  • As user root, edit /etc/fstab to change location of shared //hda folders to the secondary drive.
  • To run the diskmounter script, in the directory where the file is located, do the following:

hda-diskmounter

This is what the script added for my drive:

Added by diskmounter utility
/dev/sdb1 /var/hda/files vfat rw,user,fmask=0111,dmask=0000 0 0 

I changed second path to /var/hda/files to enable all shared files to be stored on the secondary hard drive. This is the default path for //hda file storage system.

If you get something similar like "Disk /dev/dm-0 doesn't contain a valid partition table" or "mount: unknown file system type 'lvm2pv'" its because you have LVM's that 'fdisk' can not recognize, (or something like that) its nothing to worry about if you get that when executed the hda-diskmounter script.


If the script doesn't work for you

These instructions are adapted from here

If you're planning to mount a NTFS disk, you'll need to make sure you have ntfs-3g, fuse and fuse libs all installed. If not, login as root and run:

$ yum install fuse fuse-libs ntfs-3g

Then use fdisk to find the disk by running fdisk -l (this is a lower case L not a 1). You may have to give the path (/sbin/fdisk) to make it work.

$ /sbin/fdisk -l

This should return the needed information about all your disks. Look out for your newly attached disk. In my case in among the results I can find:

Disk /dev/sdb: 120.0GB 120034123776 bytes 255 heads, 63 sectors/track.... etc etc.

I know my disk is 120GB so that's the right one. This tells us the name of the new disk which is "sdb" in my case. Running

$ sudo /sbin/fdisk -lu /dev/sdb | grep NTFS

..will give you a break down of partitions. In my case, there's just one partition, sdb1, so this is the partition I will mount.

Now we can go on to create the mount points if needs be. But because my disk contains all my music, I want it to be mounted as if it were my local "Music" folder, so for me the mount point already exists. But if just want to access your disk easily you could just as easily mount it anywhere. Commonly mount points are put in either /mnt/ or /media/. It doesn't matter where - just be consistent when you are doing this. To do this run these commands as root:

$ cd /mnt/
$ mkdir my_ntfs_disk

Substituting my_ntfs_disk for whatever you want to call it.

Now we can mount the disk in the desired location. Again as root run this command:

$ mount /dev/sdb1 /mnt/my_ntfs_drive -t ntfs-3g -r -o umask=0222

This command will make the mounted drive read only. That's great if that's what you want, but for me, since I want to save my music there, I need it to be read and writeable. For this you'll use:

$ mount /dev/sdb1 /mnt/my_ntfs_drive -t ntfs-3g -rw -o umask=0000

or in my case

$ mount /dev/sdb1 /home/USERNAME/Music -t ntfs-3g -rw -o umask=0000

because I want it mounted in my "Music" file.

Remember in both of these commands you'll need to substitute sdb1 with whatever the partition name/number is on your machine. And in the second command USERNAME is your linux username.

If you now go to your desktop, you should see the drive is mounted there. Click on it to see the contents are there. If you've mounted it as say So far so good? Ok, let's continue.

What you've achieved so far is a temporary mounting of the drive/partition. That shows it can be done but you'll need to make it permanent otherwise when you reboot it'll disappear again. For this you need to edit fstab with your favourite text editor. As root run:

$ gedit /etc/fstab

A text editor window will pop up. Enter this on the last line:

/dev/sdb1 /mnt/my_ntfs_drive ntfs-3g ro,defaults,umask=0222 0 0

  • change ro to rw and umask=0222 to umask=0000 if you want it to be writable.

You'll need to do this for every partition, so if you have several partitions on sdb, the last lines of you fstab may look something like this

/dev/sdb1 /mnt/my_ntfs_drive_C ntfs-3g ro,defaults,umask=0222 0 0 /dev/sdb2 /mnt/my_ntfs_drive_D ntfs-3g ro,defaults,umask=0222 0 0 /dev/sdb3 /mnt/my_ntfs_drive_E ntfs-3g ro,defaults,umask=0222 0 0

When you reboot, you should find your data where you want it.

Guide to Adding a Hard Drive to Fedora

This is a good guide, for advanced users, to adding a hard drive to Fedora:

http://fedoranews.org/tchung/storage/

And a good fedora 9 guide here, including a section on adding a hard drive here:

http://www.mjmwired.net/resources/mjm-fedora-f9.html

Partitioning a Brand New Disk

If you have a blank, unpartitioned, drive, you have to 1) partition it and 2) format it.

If you want to move this disk to windows machines, you may want to format it as NTFS. To do this, it's best if you do that in Windows.


To make a partition, it's best to use (as root)

           gparted

in your fedora desktop, as it's graphical and will help make decisions.