2

I just bought a Toshiba Canvio 2TB external hard drive. I then installed GParted, and reformatted the drive to ext4 (following the instructions in part 1 & 2, at this blog).

The instructions didn't say anything about this, but I think I should've added a boot flag to the drive, 'cause now it won't automount, and GParted won't show the drive, and fdisk -l doesn't even show the drive. So I'm not sure how to mount it or find a way to add a boot flag... if that's even what I need to do.

How do I get to where I can edit the drive's partitions and stuff? Can I format the unallocated 1.02MB on the drive to boot? The unallocated space does show up in GParted. I really hope I didn't just brick this $100.

UPDATE: Here's the output when I sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0003ae80

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   969058303   484528128   83  Linux
/dev/sda2       969060350   976771071     3855361    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5       969060352   976771071     3855360   82  Linux swap / Solaris

...the partition I formatted, was something like /dev/sdb or something like that, but it doesn't show up.

Zamphatta
  • 145

3 Answers3

4

Don't worry; your drive is just fine.

When you unmount a drive in Linux (which you had to do in order to format it,) sometimes it won't be re-recognized until you reboot your computer.

Try rebooting, and see if that fixes the problem.

There's nothing that GParted can do anyway that would prevent sudo fdisk -l from noticing the drive. (you did remember sudo, right? ;)

If, for whatever reason, the drive isn't recognized after you reboot, it (likely) wasn't your fault.

After rebooting, if the drive doesn't appear in the launcher, try running GParted again and see if it recognizes the drive. Then check the filesystem on the Ext4 partition (from within GParted.) It'll detect and repair any errors to the filesystem itself. After that, reboot again.

Your partition table is screwed up.

Looking at the output of sudo fdisk -l, I'd have to deduce that your partition table got corrupted. Try opening GParted and going to Device > Create Partition Table, then create a new msdos partition table (the default.) After that finishes, create a new EXT4 partition, but this time tell it to align to Cylinder instead of MiB. (You might lose a tiny bit of space, like .01 GiB tops.)
APPLY the partition creation, then expand the partition to the right, if there's any unused space an that side. (DO NOT move/expand to the left, this will defeat the point of aligning it to Cylinder.)

It seems that the drive shipped with a faulty partition table, which worked with the default formatting (somehow,) but failed when you tried to repartition it.

  • You really don't need to reboot the computer, you could just re(set)(boot)? the filesystems with sudo mount -a – Scott Goodgame May 31 '13 at 16:40
  • rebooting and reconnecting the hard drive didn't fix it. – Zamphatta May 31 '13 at 16:41
  • @Zamphatta What is the output of sudo fdisk -l after a reboot? – JamesTheAwesomeDude May 31 '13 at 16:43
  • same output as it was before I rebooted. And no, GParted isn't showing the drive yet either. – Zamphatta May 31 '13 at 16:57
  • @Zamphatta darn. I have to go, but try looking up how to use the command-line tool parted to create a new partition table on /dev/sdb. Try doing sudo parted /dev/sdb, then type mklabel msdos, then print and exit. Then reboot and see if GParted recognizes it. – JamesTheAwesomeDude May 31 '13 at 17:09
  • I'm extremely hesitant to mess around with the partition table on /dev/sda. I really can't afford to goof that up. I tried sudo parted /dev/sdb and it said Error: Could not stat device /dev/sdb - No such file or directory.. Being this seems to be a faulty partition table, I think I might return the thing and get a new one. Probably not reformat it tho.... which bums, but that might be my only choice here. – Zamphatta May 31 '13 at 17:27
  • Aww, bummer. What brand is it? I'll have to be sure not to order from them in the future... one last thing: try lsusb and see what you get. – JamesTheAwesomeDude May 31 '13 at 20:00
  • !!! What @SDsolar suggested will completely reformat your drive, in a nonstandard (unpartitioned/"superfloppy") format, and overwrite the first several sectors, losing essentially all chance of recovering any existing partitions !!! You can do it, just know that it will FORMAT your drive (and format it weirdly), not help recover anything on it! – JamesTheAwesomeDude Nov 23 '17 at 00:27
  • To do a simple wipe of the partition table (and get rid of the corruption), all you need is to do a dd if=/dev/urandom of=/dev/sdb count=24 -- and to make a rudimentary file system so the drive will mount (blank) you then want to do a mkfs /dev/sdb -- then it will mount and you can restore the contents from your backup. -- This is the CLI version of the second part of this answer - a corrupted partition table. In other words, there is no need to actually format the whole drive just because of a bad partition table. Then be careful to do orderly shutdowns in the future to avoid this. – SDsolar Nov 23 '17 at 05:48
0

You could try disconnecting the external drive and then entering the following in a terminal:

tail -f /var/log/messages

This will give you a running commentary of what your machine is up to.

Reconnect your drive and see what (if anything) is happens here and if your machine is getting an error or anything when trying to read or mount the drive.

If nothing new appears here then see if any lights on the hard drive are coming on. Perhaps the USB element of the external hard drive enclosure has failed in some way.

I hope this at least points you in the right direction

Steve N
  • 86
  • Trying tail -f /var/log/messages returns tail: cannot open/var/log/messages' for reading: No such file or directory`. Nothing happened when I reconnected. – Zamphatta May 31 '13 at 16:36
  • Sorry - try /var/log/syslog instead and you may need to sudo it Or /var/log/kern.log - it will show you if the drive is even appearing to the Kernel – Steve N May 31 '13 at 16:39
  • I have a whole ton of error messages like failed in opening HIDDEV file: /dev/usb/hiddev0. No such file or directory in there. I'm guessing this is related? – Zamphatta May 31 '13 at 16:50
0

Don't worry.. not setting a boot flag will not brick your drive (trust me-I've managed to think I've bricked more than one router!)

If your problem is having the drive mount upon boot, realize that the uuid changes upon format, so you will have to issue another sudo blkid and change /etc/fstab accordingly. So your new fstab might look something like this...

UUID={YOUR-UID}    {/path/to/mount/point}   ext4   defaults,errors=remount-ro 0 1

fill in the uuid with the results from sudo blkid and change your mount point path and you should be a-ok.

Scott Goodgame
  • 2,636
  • 15
  • 20
  • sudo blkid and /etc/fstab both only show the sda1 & sd5 partitions. I wouldn't have a clue what to add to it and I seriously can't risk mucking up my internal system 'til I can back stuff up. – Zamphatta May 31 '13 at 16:55