I bought 2 1TB hard drives to use as backup storage. These couldn’t be mounted immediately because they had not been formatted. So what to do next to prepare them for use?
NB the convention for labelling devices has apparently changed and may differ between kernel versions – so what is true for me now (Intrepid kernel 2.6.27-7) may not apply to you. So double check everything you do. You really do not want to wipe the wrong disk 😉 . I repeat, you really, really, really do not want to wipe the wrong disk. I am not an expert so double check everything.
If using an external hard drive it will be called something like /dev/sdb
Your main HDD will be something like /dev/sda
In older times IDE devices would have been HD … but now it is apparently consolidated on SD …
One test that may be useful is
sudo fdisk -l
My output was:
————————————————————————-
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005bd91
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1      120845   970687431   83  Linux
/dev/sda2          120846      121601     6072570    5  Extended
/dev/sda5          120846      121601     6072538+  82  Linux swap / Solaris
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn’t contain a valid partition table
————————————————————————-
dmesg
is also useful for final confirmation
OK now to do the deed (remember earlier warnings about checking):
sudo cfdisk /dev/sdb

Then
n
to create New partition
Then
p
to create new primary partition
Enter
to accept the size
Bootable is OK – no harm leaving it selected or selecting it.
Type should be Linux (83)
W
for Write
then
yes (not y) to proceed (NB warnings about checking earlier).
It should say it wrote partition table to disk.
Q
for Quit.
If we rerun
sudo fdisk -l
we might get something like:
————————————————————————-
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005bd91
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1      120845   970687431   83  Linux
/dev/sda2          120846      121601     6072570    5  Extended
/dev/sda5          120846      121601     6072538+  82  Linux swap / Solaris
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1      121601   976760001   83  Linux
————————————————————————-
Note that sdb no longer lacks a valid partition table.
Then we need to format the disk (in my case I chose ext3 but ext4 works too):
sudo mkfs.ext3 /dev/sdb1
The system will then write the inode tables. The disk should then be unplugged and replugged to get it to mount.
The new HDD was owned by root so I needed to add some folders and give my user permission to add/edit data etc.
sudo chown username -R 
Then open drive and add folders etc
