LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Drive name changed! (https://www.linuxquestions.org/questions/linux-software-2/drive-name-changed-4175583685/)

henrig 07-03-2016 03:36 PM

Drive name changed!
 
I have one HDD which I've split up into various partitions, one for Linux Mint 17.3, one for storing my files and others...
The one I use for storing my file, I call it Data. I wanted to automount it at start-up and followed some instructions off the net which I can't find again unfortunately.

Now Data has changed to Data1. This is the path:
/media/hh/Data1
However, in file manager where I have Home, File System listed, it says Data and in Gparted, the label is still Data.
If just the name had changed, I wouldn't be bothered but now Dropbox isn't working and I had to fix my torrent client too.
I'd like to know how I can change the name back to Data. Just going to the file system and changing the name in there doesn't work.

Now that Mint 18 is coming out, I'm tempted to wipe my HDD clean and start afresh but I've got too much data stored on it and would take too long to do a backup of everything and move it back again.

tayfie 07-03-2016 05:03 PM

Quote:

Just going to the file system and changing the name in there doesn't work.
Can you be more specific? What happens when you do something like:
Code:

mv Data1 Data
Does the automounting work correctly when you first boot and change later, or is it incorrect from boot?

sgosnell 07-03-2016 05:37 PM

The disk label and the mount point are different things. In media/hh/ you may have two different directories - Data and Data1. With the data drive not mounted, remove the Data1 directory, and mount the drive. You may need to reboot.

Did those lost instructions on the internet involve editing /etc/fstab? Blindly following instructions on random websites can be dangerous. If you can post the contents of your /etc/fstab file we might be able to give better advice.

henrig 07-04-2016 01:40 AM

Quote:

Originally Posted by tayfie (Post 5569951)
Can you be more specific? What happens when you do something like:
Code:

mv Data1 Data
Does the automounting work correctly when you first boot and change later, or is it incorrect from boot?

Forgot to mention that the automount did not work and that I nearly broke my PC. It could not start because it could not find a program or file or path. Fortunately, I also had Salix installed, so I booted to that, then retrieved the file in Mint and undid the changes. Looks like I did not undo everything.
By going to the file system, I mean, in file manager, going to the hh folder and changing the name of Data1 there. I'm not sure what or how I did it before but now if the Data drive is not mounted, it doesn't appear there. There is just an empty Data folder. If Data1 is mounted, the rename option is disabled.

mv Data1 Data yields:
mv: cannot stat 'Data1': no such file or directory
I get this before and after mounting the Data drive.

henrig 07-04-2016 01:44 AM

Quote:

Originally Posted by sgosnell (Post 5569969)
The disk label and the mount point are different things. In media/hh/ you may have two different directories - Data and Data1. With the data drive not mounted, remove the Data1 directory, and mount the drive. You may need to reboot.

Did those lost instructions on the internet involve editing /etc/fstab? Blindly following instructions on random websites can be dangerous. If you can post the contents of your /etc/fstab file we might be able to give better advice.

Only Data appears in media/hh until I mount Data1 and when this is mounted, the option to rename is disabled.

Yes, those instructions involved editing fstab. Here's the content of the file:


# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
UUID=c1d0916c-ba98-4aa0-b961-3e9f2997c126 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=c053ba08-5827-47f0-a09f-a4624d12146a none swap sw 0 0

hydrurga 07-04-2016 03:59 AM

Try unmounting the filesystem, renaming /media/hh/Data to something else, then mounting the system. I suspect that the system is auto mounting the filesystem in Data1 because the folder Data, whatever it is, already exists.

sgosnell 07-04-2016 01:11 PM

You're not mounting the drive in fstab. The only thing there is the root filesystem and swap. If you edited that file, there is no evidence of it. Remove all the directories under /media and see what happens. If it's not satisfactory, you may need to edit fstab. That's easy enough to do, and we can help you with that if you provide the correct information. The device name of the partition is essential, and is probably something like /dev/sda#, where the pound sign would be replaced by a number, whatever the number of the partition named Data might be. You can also use the UUID, which can be more robust, but we don't know what that is. Do some study of the mount command and the syntax of fstab, and it shouldn't be difficult.

henrig 07-04-2016 02:19 PM

Quote:

Originally Posted by sgosnell (Post 5570354)
You're not mounting the drive in fstab. The only thing there is the root filesystem and swap. If you edited that file, there is no evidence of it. Remove all the directories under /media and see what happens. If it's not satisfactory, you may need to edit fstab. That's easy enough to do, and we can help you with that if you provide the correct information. The device name of the partition is essential, and is probably something like /dev/sda#, where the pound sign would be replaced by a number, whatever the number of the partition named Data might be. You can also use the UUID, which can be more robust, but we don't know what that is. Do some study of the mount command and the syntax of fstab, and it shouldn't be difficult.

I cannot delete anything in /media or delete the data folder. The rename and delete options for both are greyed out.
I edited fstab but after it broke my PC, I undid the changes. But I probably didn't undo them properly or maybe the edited fstab file changed something else on my PC then.
I was never able to automount my drive.

sda4
uuid=24F0077CF0075388

I don't need to automount anything now, just get Data1 changed to Data.

hydrurga 07-04-2016 02:28 PM

Quote:

Originally Posted by henrig (Post 5570390)
I cannot delete anything in /media or delete the data folder. The rename and delete options for both are greyed out.
I edited fstab but after it broke my PC, I undid the changes. But I probably didn't undo them properly or maybe the edited fstab file changed something else on my PC then.
I was never able to automount my drive.

sda4
uuid=24F0077CF0075388

I don't need to automount anything now, just get Data1 changed to Data.

You may need to have superuser permissions to delete the Data folder (or, safer, to rename it). Have you tried that?

henrig 07-04-2016 02:50 PM

Yesss. It worked! I renamed Data to Data2 in the CLI using superuser permissions. It worked. Then I mounted the Data drive and it mounted as Data. Data1 is now gone.
However, I'm now left with Data2.
It doesn't bother me, I'll just forget about it but why do I have 2 Data folders? Is it safe to delete Data2, which is empty by the way? How did a 2nd Data folder get created?
These just help me understand what happened, if you can answer them, but my problem is solved.
Thanks guys.

hydrurga 07-04-2016 03:12 PM

Quote:

Originally Posted by henrig (Post 5570401)
Yesss. It worked! I renamed Data to Data2 in the CLI using superuser permissions. It worked. Then I mounted the Data drive and it mounted as Data. Data1 is now gone.
However, I'm now left with Data2.
It doesn't bother me, I'll just forget about it but why do I have 2 Data folders? Is it safe to delete Data2, which is empty by the way? How did a 2nd Data folder get created?
These just help me understand what happened, if you can answer them, but my problem is solved.
Thanks guys.

Great! Without knowing the specifics, I reckon that the operating system tries to auto mount the filesystem from the partition that is named Data.

It first tries to mount it in /media/hh/Data. If that folder already exists (or perhaps exists but is locked or otherwise inaccessible), it then tries to create a new folder called Data1 and mount it in that. Etc. etc...

This is a slight problem with leaving it to the operating system to auto mount filesystems on its own initiative. It's better, in my opinion, to specify in /etc/fstab exactly where you want your folders mounted. You have more control that way.

Anyway, at some point something appears to have gone wrong and /media/hh/Data was locked in some way so that the operating system couldn't mount your filesystem there.

If Data2 is truly empty (check it for hidden files), then you should be safe to delete it.

You should keep an eye on your system to ensure that this was a one-off.

P.S. If you so wish, you can mark the thread as "Solved". Yay!

sgosnell 07-05-2016 10:22 AM

Try this for the line in /etc/fstab:
Code:

LABEL=Data /media/Data ext4  users,owner,auto        0        0
Or you can replace the LABEL part with /dev/sda4, it's your choice. If you use the UUID, copy and paste the UUID string from blkid, or wherever you got it, to prevent typos. For these types of mounts, I tend to make a mountpoint somewhere else, either in my home directory or the root. It could be /Data, or /home/hh/Data,or wherever you want it to be. The primary goal is to have it someplace where it's easy for you to get to it and use it. I have an external HDD that mounts to a subdirectory in my home, because that's the easiest way for me. I don't have to muck around with permissions, etc, because it's my home. YMMV.

henrig 07-06-2016 04:04 AM

Quote:

Originally Posted by sgosnell (Post 5570800)
Try this for the line in /etc/fstab:
Code:

LABEL=Data /media/Data ext4  users,owner,auto        0        0
Or you can replace the LABEL part with /dev/sda4, it's your choice. If you use the UUID, copy and paste the UUID string from blkid, or wherever you got it, to prevent typos. For these types of mounts, I tend to make a mountpoint somewhere else, either in my home directory or the root. It could be /Data, or /home/hh/Data,or wherever you want it to be. The primary goal is to have it someplace where it's easy for you to get to it and use it. I have an external HDD that mounts to a subdirectory in my home, because that's the easiest way for me. I don't have to muck around with permissions, etc, because it's my home. YMMV.

Tried that with UUID and it worked! Now my drive automounts and my PC didn't get broken in the process. Amazing powerful single line of code.

sgosnell 07-06-2016 12:47 PM

UUID and LABEL will both work fine. I prefer LABEL because it's almost always shorter and easier than UUID, which is a long string of random characters, thus less subject to typos. But that's a personal preference, and UUID certainly works.


All times are GMT -5. The time now is 06:00 AM.