{"id":182,"date":"2008-11-10T20:55:23","date_gmt":"2008-11-10T08:55:23","guid":{"rendered":"http:\/\/p-s.co.nz\/wordpress\/?p=182"},"modified":"2012-05-30T12:53:54","modified_gmt":"2012-05-30T00:53:54","slug":"using-cfdisk-to-prepare-a-usb-hdd-to-store-backups","status":"publish","type":"post","link":"http:\/\/p-s.co.nz\/wordpress\/using-cfdisk-to-prepare-a-usb-hdd-to-store-backups\/","title":{"rendered":"Using cfdisk to prepare a USB HDD to store backups"},"content":{"rendered":"<p>I bought 2 1TB hard drives to use as backup storage.  These couldn&#8217;t be mounted immediately because they had not been formatted.  So what to do next to prepare them for use?<\/p>\n<p>NB the convention for labelling devices has apparently changed and may differ between kernel versions &#8211; 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 \ud83d\ude09 .  I repeat, you really, really, really do not want to wipe the wrong disk.  I am not an expert so double check everything.<\/p>\n<p>If using an external hard drive it will be called something like \/dev\/sdb<br \/>\nYour main HDD will be something like \/dev\/sda<\/p>\n<p>In older times IDE devices would have been HD &#8230; but now it is apparently consolidated on SD &#8230;<\/p>\n<p>One test that may be useful is<br \/>\n<code>sudo fdisk -l<\/code><br \/>\nMy output was:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><code>Disk \/dev\/<strong>sda<\/strong>: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nDisk identifier: 0x0005bd91<\/p>\n<p>   Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sda1   *           1      120845   970687431   83  Linux<br \/>\n\/dev\/sda2          120846      121601     6072570    5  Extended<br \/>\n\/dev\/sda5          120846      121601     6072538+  82  Linux swap \/ Solaris<\/p>\n<p>Disk \/dev\/<strong>sdb<\/strong>: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nDisk identifier: 0x00000000<\/code><br \/>\n<strong><br \/>\nDisk \/dev\/sdb doesn&#8217;t contain a valid partition table<\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><code>dmesg<\/code><br \/>\nis also useful for final confirmation<\/p>\n<p>OK now to do the deed (remember earlier warnings about checking):<\/p>\n<p>sudo cfdisk \/dev\/sdb<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.p-s.co.nz\/images\/cfdisk.jpg\" alt=\"cfdisk when no existing partitions\" \/><\/p>\n<p>Then<br \/>\nn<br \/>\nto create New partition<br \/>\nThen<br \/>\np<br \/>\nto create new primary partition<br \/>\nEnter<br \/>\nto accept the size<br \/>\nBootable is OK &#8211; no harm leaving it selected or selecting it.<br \/>\nType should be Linux (83)<br \/>\nW<br \/>\nfor Write<br \/>\nthen<br \/>\nyes (not y) to proceed (NB warnings about checking earlier).<br \/>\nIt should say it wrote partition table to disk.<br \/>\nQ<br \/>\nfor Quit.<\/p>\n<p>If we rerun<br \/>\nsudo fdisk -l<br \/>\nwe might get something like:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><code>Disk \/dev\/sda: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nDisk identifier: 0x0005bd91<\/p>\n<p>   Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sda1   *           1      120845   970687431   83  Linux<br \/>\n\/dev\/sda2          120846      121601     6072570    5  Extended<br \/>\n\/dev\/sda5          120846      121601     6072538+  82  Linux swap \/ Solaris<\/p>\n<p>Disk \/dev\/sdb: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nDisk identifier: 0x00000000<\/p>\n<p>   Device Boot      Start         End      Blocks   Id  System<br \/>\n<strong>\/dev\/sdb1   *           1      121601   976760001   83  Linux<\/strong><\/code><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note that sdb no longer lacks a valid partition table.<\/p>\n<p>Then we need to format the disk (in my case I chose ext3 but ext4 works too):<\/p>\n<p><code>sudo mkfs.ext3 \/dev\/sdb1<\/code><\/p>\n<p>The system will then write the inode tables.  The disk should then be unplugged and replugged to get it to mount.<\/p>\n<p>The new HDD was owned by root so I needed to add some folders and give my user permission to add\/edit data etc.<br \/>\n<code>sudo chown username -R <username> \/media\/disk\/<\/code><br \/>\nThen open drive and add folders etc<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I bought 2 1TB hard drives to use as backup storage. These couldn&#8217;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 &hellip; <a href=\"http:\/\/p-s.co.nz\/wordpress\/using-cfdisk-to-prepare-a-usb-hdd-to-store-backups\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/182"}],"collection":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":16,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":914,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/182\/revisions\/914"}],"wp:attachment":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}