1

the problem...

My external HDD on a USB port is listed as device /dev/sdc with partition 1 of that drive /dev/sdc1 mounted on /media/mark/Seagate Expansion Drive.

The problem is the spaces, I can't write anything to the drive, it results in an error.

I need to be able to use cat or dd to pipe to zip (with preference) and store the compressed file on the /media/mark/Seagate Expansion Drive.

Suggestions on other methods of accessing the drive, I have tried changing the drive label but that results in a warning and it won't change.

2

The correct, best solution would be changing the label of the disk. I too had problem with some disk and needed to do that in Windows (grrrr).

Two solutions:

  1. learn to quote the filenames correctly:

     ls "/media/mark/Seagate Expansion Drive/"
    

    (notice the ") will work. See also http://www.linuxjournal.com/content/bash-quoting or http://www.hypexr.org/bash_tutorial.php#spaces, and yes, spaces in file names are evil.

    So for example to write to file in the disk you need to use

    dd if=something of="/media/mark/Seagate Expansion Drive/file.out" 
    

    or whatever you are using.

  2. create a symbolic link

     ln -s "/media/mark/Seagate Expansion Drive/" /media/mark/mydisk
    

    and use now /media/mark/mydisk. It will work 99% of the cases... if you take care to not use it when the disk is not mounted.

What does not work is trying to rename the mountpoint with mv:

 sudo mv "/media/mark/Seagate Expansion Drive/" /media/mark/mydisk
 mv: cannot move ‘/media/mark/Seagate Expansion Drive/’ to ‘/media/mark/mydisk’: Device or resource busy

because a mount-point semantics are quite different from a plain directory.

2
  • 1
    nice one, not one of the examples I had seen wrapped that device name and path in quotes, all I had ever been shown as example was an unquoted string. I will look at symbolic links later, bit of a learning curve here, you know, old dog, new tricks, be gentle... :) Mar 2 '15 at 11:16
  • 1
    You can also "escape" spaces which would look like /media/mark/Seagate\ Expansion\ Drive/. @Rmano: gparted can handle spaces in file names nowadays... ;-)
    – Fabby
    Mar 6 '15 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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