20

I'm getting this error when trying to repartition an external drive: "".

I want to run fsck -fy on the drive, but don't know the proper syntax for doing it on an external drive?

Can anyone help me out with this problem?

32

Actually you want to do:

% sudo fsck_hfs -fy /dev/disk1s1 (depending on what partition you want to check).

It won't work with just fsck you have to put fsck_hfs as the command to run.

  • 2
    This is the best answer. Before you run it, List all your disks with diskutil list My SD card is disk2. Then you want to find the partition number, so do something like ls /dev/disk2*. This results in disk2s1. So the final command I run is this sudo fsck_hfs -f /dev/disk2s1. NOTE: I purposly formatted my SD card as hfs. Normally they are using like fat or something. – portforwardpodcast Dec 14 '15 at 9:46
8

I'm getting this error when trying to repartition an external drive: ""

That's a very descriptive error indeed.


In order to run fsck on an external drive, you first need to find out the identifier of the drive. Run diskutil list and check the name of the volume listed under IDENTIFIER – it'll be something like disk3s4, for example.

Use that name to run fsck. You can also pass the -f option to force checking a clean filesystem.

sudo fsck /dev/disk3s4

fsck has shorthands for diverse file system types:

  • fsck_hfs for HFS, use the -f option to force checking journaled systems
  • fsck_exfat for ExFAT (no -f option here)
  • fsck_msdos for FAT (no -f option here)
  • Actually, it looks like as of 10.9, you can't use fsck without some sort of flag. Using the command as given here results in the help/usage output. – ray Dec 15 '13 at 20:43
  • See Paul’s answer - you have to use fsck_hfs. – Zev Eisenberg Feb 17 '14 at 21:46
2

I had to run with the -l flag:

diskutil list # find your identifier
/sbin/fsck_hfs -l -f /dev/disk16

The -l flag tells fsck to check the drive in read only mode.

0

This is not a direct answer to the original question, but closely related.

Another option is to use diskutil itself to verify or repair an external drive.
I'm not sure how it compares to fsck, but it fixed my external drive that was not mounting after I accidentally left it plugged in during a restart for a system update.

diskutil list  # to find the IDENTIFIER
  (some internal disks listed first)
  /dev/disk2 (external, physical):                                              
    #:                    TYPE NAME                    SIZE       IDENTIFIER
    0:   GUID_partition_scheme                        *500.1 GB   disk2     
    1:                     EFI EFI                     209.7 MB   disk2s1   
    2:               Apple_HFS FreeAgent GoFlex Drive  499.8 GB   disk2s2   

and then commands such as

diskutil verifyDisk disk2
diskutil verifyVolume disk2s1
diskutil verifyVolume disk2s2

for some reason just running the verify commands solve my issue, but if you need to go further there are also repair commands

diskutil repairDisk disk2
diskutil repairVolume disk2s1
diskutil repairVolume disk2s2

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.