A fool’s guide to installing a new hard drive in my Linux box.
(1) First I bought a new drive. Nothing fancy, Seagate 2 TB 3.5″ HD. I want extra data space, not a boot disk. I just want to mount it as a multimedia repository. Audacity generates a lot of GB.
(2) Second, I found an empty bay in my tower case and slotted the drive in and fastened it in with all four screws.
(3) Ran a SATA cable from the drive to an empty plug on the motherboard, and connected power to the new drive.
(4) Disconnected all external storage and booted up, and noticed that the drive showed up in the boot output. (Disconnected external storage to make identifying the correct disk easier when creating partitions.)
(5) I know that my existing HD is sda. Ran gparted. (Applications -> System -> Administration -> Gnome partition editor in the Debian menu structure).
(6) Waited while gparted found the partitions on all the attached disks.
(7) Identified new disk as sdb. Good.
(8) Created partition table: I chose gpt, but msdos works usually too. Device -> Create Partition Table -> select type.
(9) Right click on its entry in the partition editor window. Selected ‘New’ and added details as preferred. I like ext4, used the whole disk, and gave it a label different from any other disks. It had to be Primary since it is the only partition on the disk.
(10) Clicked ‘Add’, then ‘Apply’. Closed the dialogue when successfully completed. The partition editor took a few seconds and found the new partition.
(11) Okay. Now, to get it to mount on boot. The modern way uses a sort of ‘universal ID’ for the drive — UUID are four letters that come to mind. I just used the fact that the partition is called sdb1.
(12) Created a mount point in my file tree.
$ cd $ mkdir Music
I was not acting as root at this point — because this is my desktop machine and my data. I am treating it as part of /home/myusername, not creating a drive for everyone to see.
(13) Then edited /etc/fstab. This has to be done as root
$ sudo vim /etc/fstab
This is the added text in /etc/fstab.
#New 2TB GB drive as ~/Music /dev/sdb1 /home/myusername/Music ext4 rw,user,exec,auto,errors=remount-ro 0 2
(14) Then gave the machine a reboot and saw what happened…
(15) Use the ‘disk free space’ command to see if I can see the new disk.
$ df -h
Here is the output for the new disk…
Filesystem Size Used Avail Use% Mounted on /dev/sdb1 1.8T 196M 1.7T 1% /home/myusername/Music
(16) Need to do a test… Can I write to it? Test:
$ touch /home/myusername/Music/testfile
No! Because when mounted Music is owned by root, not by me.
$ sudo chown myusername /home/myusername/Music/ $ touch /home/myusername/Music/testfile
Success… (Note, this may not be the cleverest way to do all this, it only works.)
(18) Now reboot and see if I can still write to it…
(19) Yep. OK, now put the sides back on the tower and copy the back-up to the new data space… Yep, that works.