PuppyThis forum is for the discussion of Puppy Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I don't recommend you run things as root, which is what it appears you're doing. Weird though then that it doesn't also have write privileges to that drive, unless that drive happens to be mounted as read-only. A simple issue of the mount command will show you what's mounted and what mode the media is mounted as, ro or rw.
# mount /dev/sdb1 /mnt
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.
I don't think sdb1 will appear in the filesystem -- it is a block device.
Having a directory named sdb1 under the /mnt tree is not a problem, it can have the same name as the device, the system can tell the difference. In fact I do this same sort of convention, myself.
Quote:
Originally Posted by Fixit7
On my system, sdb1 is a NTFS external hard drive.
# mount /dev/sdb1 /mnt
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.
A few things to try. Unmount it and then re-mount it. Verify that it is mounted where you believe it to be, i.e. what is the actual output of the mount command with respect to this particular external drive? When you do have it mounted, can you cd to a directory on there and create a file, like can you do something like:
Code:
echo 1 > test.txt
And then perform an ls -l to see what the attributes of that file are. Something is wrong with how you can access that drive, however right now it's not apparent.
Here's an example of a mounted read-only thumb drive added to my system as well as a two partition compact flash which is RW:
Code:
/dev/sdf1 on /media/Live_Distro type iso9660 (ro,nosuid,nodev,uid=1000,gid=1001,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks)
/dev/sdb1 on /media/3e0f0916-712c-49a4-baa0-71c903e8fa44 type ext2 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdb2 on /media/18d85447-a529-465e-b621-7e70f6744c2d type xfs (rw,nosuid,nodev,uhelper=udisks)
I can't write to /media/Live_Distro because it is RO
I however can write to either of /media/3e0f0916-712c-49a4-baa0-71c903e8fa44 or /media/18d85447-a529-465e-b621-7e70f6744c2d because those are both RW. When I perform an ls -l on my /media directory, those mounted directories are owned by root and when I try to write data to them, I do have to be root.
This is all, already resolved supposedly by what you've said. The only other point is that as root I also have RWX permissions for those directories so make sure the directories allow root that access.
Further, make sure that the Linux_Files directory exists on your external disk. A copy will fail if the target directory is not present, even though the error says something totally different, I've seen misleading errors before. There are also other flags for cp, such as -v and -f.
OK fine. It's somewhat helpful in that it shows that the subdirectory is RWX and owned by root.
Can you cd to that directory and create a file?
Code:
echo 1 > test.txt
Can you copy a file to there using the command line?
Code:
cd $HOME
echo 2 > test2.txt
cp test2.txt /mnt/sdb1/Linux_Files/.
If you can do these things, I have no real explanation, the cp in your script should work. You could put "set -xv" after the #!/bin/sh or #!/bin/bash line in your script to enable some verbose output, but not sure what it will tell you any more than what you're getting.
If you can't do those test things, then you need to figure out why. Right now I don't see any reason why those tests shouldn't work.
The only other thoughts that I have are that the file already exists where you want to copy it and it is locked, owned by another user, and/or the privileges do not allow even root to erase or modify it. I'd be curious if you could copy a totally different file to that same directory. Or if the file Tahr_6.0_bookmarks.html already exists.
Code:
cd $HOME
echo 1 > test.txt
cp test.txt /mnt/sdb1/Linux_Files/.
ls -l /mnt/sdb1/Linux_Files
rm -f /mnt/sdb1/Linux_Files/Tahr_6.0_bookmarks.html
cp -vf bookmarks.html /mnt/sdb1/Linux_Files/Tahr_6.0_bookmarks.html
I keep coming back to "your root" you should be able to do this, and especially if you can create a file in the /mnt/sdb1/Linux_Files directory. So it would seem that either the source file bookmarks.html is locked somehow (very unlikely, especially for reading) or the target location/file is locked.
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.