XBMC Part III: Adding a hard drive

16 01 2011

In one of my previous posts I explained how to install XBMC Live on a USB pen drive. My USB pen drive is 8 gigabyte large; while that is enough for XMBC to run, the 8 gig is not even enough to store one (High Definition) movie nowadays.

For that reason I added a 2 terabyte internal hard drive to my HTPC system. The hard drive is fresh from the factory,  and is ready for its first run. Before you continue with this how-to, be aware that any data present on the hard drive will be irreversibly deleted.

  1. Open a command line terminal and list all available fixed disks.
    sudo fdisk –l
  2. In the output of fdisk command search for your new hard drive. You can probably find by the size of your hard disk. Also, there shouldn’t be any partitions on the hard drive (if it is a new hard drive). Remember the path of the hard drive; in this case it’s: /dev/sda
    Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
  3. The next step is to create a partition on the hard drive using fdisk <disk>.
    sudo fdisk /dev/sda
  4. This command will open the fdisk prompt. I am going to create one NTFS partition on the hard drive occupying the entire disk. Your setup can differ from mine, so feel free to create other partitions. Below, I will show the transcript of my setup. You can press m to see more information about the available commands.

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    Partition number (1-4): 1
    First cylinder (1-243201, default 1): 1
    Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201):
    Using default value 243201

    Command (m for help): t
    Selected partition 1

    Hex code (type L to list codes): 7
    Changed system type of partition 1 to 7 (HPFS/NTFS)

    Command (m for help): w

  5. You can check the partitions of your hard drive using the fdisk –l command.
    sudo fdisk –l
  6. It will show the newly created partitions on the hard drive.
    Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
    255 heads, 63 sectors/track, 243201 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
        Device Boot      Start         End      Blocks   Id  System

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1      243201  1953512001    7  HPFS/NTFS

  7. To create a NTFS filesystem on the new partition use the mkfs.ntfs command (make filesystem).
    sudo mkfs.ntfs /dev/sda1


    sudo mkfs.ntfs –f –L Data /dev/sda1
  8. The latter of the above commands uses the option –f for fast creation of the filesystem. If you don’t specify this option, creating a 2Gig NTFS filesystem can take up to 4 hours. The –L Data options assigns the label “Data” to the filesystem.
    sudo mkfs.ntfs –f –L Data /dev/sda1
  9. Create a new directory in the user folder. This directory will ‘point’ to the new hard drive. I will name this directory Data as it will contain my data. Replace <user> with your username. 
    mkdir /home/<user>/Data
  10. Now that the partition is created and has a filesystem, the new disk can be mounted. The file fstab contains the filesystem table. Open this text file using the nano.
    sudo nano /etc/fstab
  11. Add the following line to fstab text file. Press Ctrl+X to save, Y to confirm. 
    /dev/sda1 /home/<user>/Data ntfs rw 0 0
  12. Mount the hard drive. The option –a will use the fstab file to mount the drives. 
    sudo mount -a

The hard drive is now ready to use.




2 responses

22 05 2011
Ian McCarthy

Thanks so much I’ve trying for a file but couldn’t find a competent guide to get these hdds working.

25 02 2012

Sorry but I’m already lost in the first step 🙂 How do I open up the command line terminal? I installed OpenElec and I got the same situation as you: the OS is installed on the USB and added two fresh 2TB HDD’s in the HTPC that still need to be partitioned. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: