Find the answer to your Linux question:
Results 1 to 8 of 8
I bought a new usb external hard drive and formatted it for use (mkfs), but I accidentally specified /dev/sdc instead of /dev/sdc1 (which is how the device showed after powering ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    8

    mkfs with wrong device


    I bought a new usb external hard drive and formatted it for use (mkfs), but I accidentally specified /dev/sdc instead of /dev/sdc1 (which is how the device showed after powering it). I even received a warning "/dev/sdc is entire device, not just one partition! Proceed anyway?" and foolishly replied "y" thinking the device may have been provided with partitions since it is 2 TB.

    So now sdc appears in /dev after powering the device (as it did originally), but not sdc1. And the mount mechanisn doesn't work, although I can manually mount /dev/sdc as

    sudo mount -o exec,dev,suid,rw /dev/sdc /mnt/fc

    How do I recover from this? Note that there is no data loss here.

    Interestingly, I can insert a thumb drive (for example) and /dev/sdc1 will appear and the thumb drive will mount. But if I repower the usb hard file, it is back to /dev/sdc only.

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Could you post the output of fdisk -l command here?
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    Here it is. sda and sdb are the two hard drives in this system. sdc usually comes into existence via udev with thumb drives, external hard drives, etc. and then with a corresponding /dev/sdc1, etc

    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0004ca85

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 64 514048+ 83 Linux
    /dev/sda2 65 5163 40957717+ 83 Linux
    /dev/sda3 5164 5928 6144862+ 83 Linux
    /dev/sda4 5929 19457 108671692+ 5 Extended
    /dev/sda5 5929 6310 3068383+ 83 Linux
    /dev/sda6 6311 6565 2048256 83 Linux
    /dev/sda7 6566 6820 2048256 82 Linux swap / Solaris
    /dev/sda8 6821 19457 101506671 83 Linux

    Disk /dev/sdb: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0000e391

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 3824 30716248+ 83 Linux
    /dev/sdb2 3825 15982 97656767 f W95 Ext'd (LBA)
    /dev/sdb5 3825 5770 15624540 83 Linux
    /dev/sdb6 5770 8809 24414062 83 Linux
    /dev/sdb7 8809 12158 26902343+ 83 Linux

  4. #4
    Just Joined!
    Join Date
    May 2011
    Posts
    44
    assuming your usb is /dev/sdc ypu can zero out the device and start fresh with dd.

    Code:
    dd if=/dev/zero of=/dev/sdc
    then remove and replace and you can format it like a new device. This will copy zeros over whatever device you specify with the of parameter, make sure you specify the correct device.

  5. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Quote Originally Posted by whgorder
    Interestingly, I can insert a thumb drive (for example) and /dev/sdc1 will appear and the thumb drive will mount. But if I repower the usb hard file, it is back to /dev/sdc only.
    We need to check partition structure of /dev/sdc only but fdisk is not listing it. Are you sure that USB Hard disk was active/working while executing fdisk -l command?

    Quote Originally Posted by three18ti
    assuming your usb is /dev/sdc ypu can zero out the device and start fresh with dd.

    Code:
    dd if=/dev/zero of=/dev/sdc
    There is no need to rewrite whole disk with zeros. It's a 2TB disk and this process will take a lot of time, like forever.
    I would suggest writing first 512 bytes only. It will clean MBR, Partition Structure and Hardware Signature, if any.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  6. #6
    Just Joined!
    Join Date
    Jul 2006
    Location
    localhost
    Posts
    31
    Since you haven't actually stored any data on the drive yet, I would suggest using parted or fdisk and tell it to create a new partition table on it.
    After that it's just a simple matter of creating a primary partition with the same tool and then format it like you wanted (using /dev/sdc1).

    If you want a GUI tool to do it, GParted will do the trick.

  7. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    I agree with Djhg200. If there isn't any data to be recovered from your 2TB disk then use any Partition Manager to recreate partition structures. Most of Linux distros have Graphical Partition Manager. You can use LiveCD of any distro. Make sure to create partitions in correct disk this time.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  8. #8
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    I fixed it. The result of the initial incorrect operation was to destroy the master boot record. I think that's why it didn't show in fdisk or parted. I created an MBR on a windows box and then proceeded as originally intended using the proper device.

    Lesson learned: examine /proc/partitions before and after powering the drive to properly locate the device in /dev to act on whether it be a usb flash stick or an external hard drive. In my case, look carefully at your command before pressing enter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •