XBMC Part III: Adding a hard drive

16012011

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.

Open a command line terminal and list all available fixed disks.

sudo fdisk –l

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

The next step is to create a partition on the hard drive using fdisk <disk>.

sudo fdisk /dev/sda

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.

To create a NTFS filesystem on the new partition use the mkfs.ntfs command (make filesystem).

sudo mkfs.ntfs /dev/sda1

or

sudo mkfs.ntfs –f –L Data /dev/sda1

The latter of the above commands uses the option –f for fastcreation 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

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

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

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

Mount the hard drive. The option –a will use the fstab file to mount the drives.

2 responses

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!