Drive shown as empty after applying chmod

It seems that I did something unbelievably stupid in an attempt to access files in an external drive containing data. The drive had previously been used on another system and contains about 3.5TB of data. I connected to the system and was able to read data, however I was not able to write to the drive. I followed someone’s advice to use the command:

sudo chmod -R 666 /run/media/alex/Data-Drive

This executed okay, but now shows the drive as empty; zero files and zero directories. It still shows the drive as containing 3.5TB of data though. Did I mess this up permanently?

Any help would be much appreciated.

Is alex your username?

Then you could try:

sudo chown -R alex:alex /run/media/alex/Data-Drive

Edit. Is your drive formatted as ntfs?

Tried that - unfortunately no effect. The drive is formatted as ext4.

Okay, let’s try a different approach.

Run

df

and pay attention to the dev/sdbx where your data drive is. You will need that for the next step.

Next unmount:

sudo umount /dev/sdbx

You can now mount it again:

But first, create a folder where the drive will be mounted:

sudo mkdir /media
sudo mkdir /media/GiveAName

And finally mount it again:

sudo mount -o defaults /dev/sdbx /media/GiveAName

During this step I get the error:

mkdir: cannot create directory ‘/media/Data_Disk’: No such file or directory

Hmm, it’s not recommended to use /run/media, so let’s use /media

sudo mkdir /media
sudo mkdir /media/GiveAName
sudo mount -o defaults /dev/sdbx /media/GiveAName

I rather guess the mkdir error comes from /media not existing by default, and parent folders aren’t created when needed unless you tell it to.

sudo mkdir -p /media/Data_Disk

/run/media/<user> is commonly used by file managers for mounting devices within.


2 Likes

I stand corrected. I edited the post to avoid further confusion for other users.

1 Like

Okay, back to this issue. Tried this. I was able to mount under the new name, but the drive still shows up as blank.

Let’s hope it’s a matter of permissions.

Consider first what we discussed before; since your username is alex, use:

sudo chown -R alex:alex /media/GiveAName

However, you can use the command below If you want to share the drive with other users while still being able to have your own private files and dirs.

sudo chmod 770 /media/GiveAName

And you can use the command below to change the ownership of all existing files and sub-directories below that path. Any user will be able to read and write the files, so treat this as your last attempt.

sudo chmod -R a+rwX /media/GiveAName

Without “exec” permissions, directories cannot be traversed. Not sure why the suggestion was to use “666” when “777” would have been preferable. Besides, it was likely an ownership that didn’t match your current user; not simply the “permission” bits.


Just to make sure of something,

df -h

And also,

sudo lsblk -o name,fstype,size,fsused

Are you sure about that? Shouldn’t the read permission suffice?

Yes, very sure.

Read will only let you list the contents within, but Exec is needed to actually traverse.

1 Like

Sorry for the spotty replies. Been busy with a number of other things and get back to it when an opportunity arises. I did apply the EXEC permissions recursively, and that did indeed resolve the problem. I can now fully access the files.

On a side note, I have just come across a similar problem with KiCad. I have a project drive installed in the computer for a good many years, and several distributions of Linux. I have a directory that stores my internal KiCad libraries. This is my first installation of Manjaro from about 2 months ago, and I reference files on this project drive. I launched KiCad in Manjaro for the first time today, and when displaying the 3D view of the PCB, no components were displayed on the board. This board was designed about 2 years earlier on Mint Cinnamon. When I checked the 3D model (.step files) references, I found that they reference:

/media/alex/COMMON/002_INTERNAL_LIBRARIES/KiCAD/Libraries/3D_Libs/EXD-KYCON_GMJXHT-MM-S-88_RA2.STEP

but if I navigate to the model again, it shows up as:

/run/media/alex/COMMON/002_INTERNAL_LIBRARIES/KiCAD/Libraries/3D_Libs/EXD-KYCON_GMJXHT-MM-S-88_RA2.STEP

and the model displays properly in both the footprint editor, and the PCB 3D viewer. I have 100-200 components in the library and would prefer not to modify each one manually, though that would not be the end of the world. Is there a way of doing this globally that would not cause other problems?

Well, I am glad you can access your drive once again. You can just change the mount point to match what is on your models. Now you know how to proceed. Unmount, edit the mount point, and mount it again.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.