LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   Mounting Separate partition. (https://www.linuxquestions.org/questions/centos-111/mounting-separate-partition-4175557536/)

gardenair 10-30-2015 12:19 AM

Mounting Separate partition.
 
4 Attachment(s)
hi,
I am using CentOS 6.5 in a non production environment. During installation I keep free space 5 GB.After installation i open terminal and format that partition,create a folder "common-share",
Restart the system.Now in desktop i can see my separate partition.I can see it in /etc/mtab file that it is mounted on "sda4".
The issue it I want to rename the name which is

Code:

/dev/sda4/  /media/211975bc-3d50-41fb-b88d-4a3ec85a0720
I want to mount it as in /etc/fstab

Code:

/dev/sda4  /common-share  ext4  defaults  0  0
Please guide me how can I fix the issue.Kindly see the attachments.

thanks
gardenair

berndbausch 10-30-2015 03:07 AM

Your screenshots are a bit confusing. The sda4 line in fstab is commented out, therefore disabled; no wonder the partition is not mounted automatically. Also, you seem to have a directory named /verylongstringlookinglikeaUUID/common-share; why?

To achieve what you want:
  • Ensure /common-share exists
  • Remove the comment sign from the sda4 line in fstab.
    From then on, each time you reboot the system, sda4 will be mounted at /common-share.
  • umount /dev/sda4
  • mount -a

The latter just mounts everything in fstab.

gardenair 10-30-2015 06:46 AM

I have even created a folder inside /dev/sda4 as "common-share" add it in /etc/fstab file.

Code:

/dev/sda4  /common-share  ext4  defaults  0  0
After rebooting I can not see my new partition by using mount command.

if i remove the entry from /etc/fstab then it appear in my desktop(after rebooting) .Just like you plug a USB stick/drive in the system it show the drive icon.

I do 'not know where i am doing wrong. One thing you can see in the 1st post snaps that the after giving comments (/etc/fstab) with

Code:

# /dev/sda4  /common-share  ext4  defaults  0  0

the partition is visble (after rebooting) . under /etc/mtab file it is visible.

where i am doing mistake not know...

qlue 10-30-2015 08:21 AM

Where, exactly, do you want the partition to be mounted? /common-share would be in the root directory.
You have to create this directory in the root directory with mkdir in order for the entry in fstab to work.

berndbausch 10-30-2015 09:07 AM

Quote:

Originally Posted by gardenair (Post 5442285)
I have even created a folder inside /dev/sda4 as "common-share" add it in /etc/fstab file.

You have to create it outside of /dev/sda4. Specifically:
Code:

mkdir /common-share
Quote:

After rebooting I can not see my new partition by using mount command.
My guess is that /common-share doesn't exist. In any case, you should see an error message while the system gets initialized, probably also in /var/log/messages.

Quote:

if i remove the entry from /etc/fstab then it appear in my desktop(after rebooting) .Just like you plug a USB stick/drive in the system it show the drive icon.
This is so because the desktop software detects an unmounted filesystem and mounts it automatically, just like it would with a USB stick, a CDROM or a network drive that becomes available.

suicidaleggroll 10-30-2015 02:02 PM

Quote:

Originally Posted by gardenair (Post 5442285)
I have even created a folder inside /dev/sda4 as "common-share" add it in /etc/fstab file.

Code:

/dev/sda4  /common-share  ext4  defaults  0  0

That's not how it works.

The second column in fstab tells the system where you want to mount the device. Once the device is mounted, the mount location (/common-share in your example) will be the root of the drive, and all of the contents of the drive will be found inside of that directory. For that reason, the mount location needs to be created on your root filesystem BEFORE you can mount the drive there.

In your case, your fstab is trying to mount the drive in /common-share, AND you've also created a directory called common-share on the drive. So once you create /common-share and the system is actually able to mount the drive, the directory you created will be /common-share/common-share (and you'll also have /common-share/lost+found, and /common-share/whatever-else-you-have-on-your-drive).

gardenair 11-02-2015 01:43 AM

2 Attachment(s)
Thanks "suicidaleggroll" I have tried working according to your direction. In the /dev/sda4 i delete the folder"common-share" and add the line in

/etc/fstab file as

Code:

/dev/sda4  /common-share  ext4  defaults  0  0
After restart the system,open Gnome Under computer I can see only CD/DVD drive and Filesystem Icone.

At end I use comments with

Code:

# /dev/sda4  /common-share  ext4  defaults  0  0
Now it show me the separate partition (After restarting system). One thing more I want to add that I am doing all this in a non production environment. Iam using VMware Workstation .

One thing more how can I change the label name of the dive/sda4.

I am also attaching the screen short herewith.

suicidaleggroll 11-02-2015 07:58 AM

And did you create /common-share???

Uncomment the line in fstab, run "umount /dev/sda4", run "mount -a", and post the output.

gardenair 11-02-2015 11:42 PM

5 Attachment(s)
In my previous past i not create the folder inside "/dev/sda4" i not give comments (# vi /etc/fstab ) for /dev/sda4 but not success.

well now I have created "common-share" folder in /dev/sda4 ,uncomment the line in fstab ,it show me the drive


The command which you have mentioned for output

Code:

# mount -a
you an see in the attachment and also with the said command with the attachment name "mount -a"

suicidaleggroll 11-03-2015 08:50 AM

:bangs head against wall:

1) Remove the directory common-share from your drive
2) Create the directory common-share in /, the root of your filesystem, currently mounted from sda2

As you can CLEARLY see from the screenshot you posted (please don't post screenshots when you can easily just copy/paste the text, it's a pain):
Quote:

# mount -a
mount: mount point /common-share does not exist
You need to make the directory before you can mount the drive there. This directory needs to be created in /, NOT IN SDA4.

PLEASE READ THE ABOVE POSTS ON THIS TOPIC, this was covered already, in detail, see below:

Quote:

Originally Posted by qlue (Post 5442317)
Where, exactly, do you want the partition to be mounted? /common-share would be in the root directory.
You have to create this directory in the root directory with mkdir in order for the entry in fstab to work.

Quote:

Originally Posted by berndbausch (Post 5442335)
You have to create it outside of /dev/sda4. Specifically:
Code:

mkdir /common-share

My guess is that /common-share doesn't exist. In any case, you should see an error message while the system gets initialized, probably also in /var/log/messages.

Quote:

Originally Posted by suicidaleggroll (Post 5442501)
That's not how it works.

The second column in fstab tells the system where you want to mount the device. Once the device is mounted, the mount location (/common-share in your example) will be the root of the drive, and all of the contents of the drive will be found inside of that directory. For that reason, the mount location needs to be created on your root filesystem BEFORE you can mount the drive there.

In your case, your fstab is trying to mount the drive in /common-share, AND you've also created a directory called common-share on the drive. So once you create /common-share and the system is actually able to mount the drive, the directory you created will be /common-share/common-share (and you'll also have /common-share/lost+found, and /common-share/whatever-else-you-have-on-your-drive).

http://www.ibm.com/developerworks/li...pic1-v3-104-3/
http://www.tldp.org/HOWTO/Hard-Disk-Upgrade/mount.html

gardenair 11-03-2015 11:41 PM

3 Attachment(s)
Thanks "suicidaleggroll" for your reply and guiding me. All thumbs upto you.:hattip:
There is a technical reason which i want to understand regarding to it.

I am going back a bit when i did installation and keep free apace i.e 5 GB.

I use
Code:

# fdisk /dev/sda
Create anew partition (primary by pressing 4) ,save and exit from fdisk septup,restart the system and then

Code:

# mkfs.etx4 /dev/sda4
This format my free space and create ext4 file system on it.Just reboot the system.
Login ,here i can see a separate drive consisting of almost 5GB space on my desktop.

As to my problem with direction of your guidance i delete the folder from /dev/sda4 and create a folder under "/" with name "common-share"and in etc/fstab i add the line

Code:

/dev/sda4  /common-share  ext4  defaults  0  0

Restart the system.

In the "/" i can see the the folder properties which show it size almost 5 GB and with the mount command it is clearly visible that /dev/sda4 as mounted "common-share" folder. :)


Theoretically why it not show as a separate drive. I would be thankful if you kindly en-light on it.

berndbausch 11-03-2015 11:57 PM

I believe Gnome, the desktop software, only shows separate drives if they are mounted by Gnome - that is, Gnome detects the presence of currently not mounted media and mounts them automatically. Typical cases are CDROMs and USB drives.

In this case, however, the drive was already mounted at an early phase of system initialization, when fstab is processed and before Gnome started. Therefore Gnome took no action. The same is true for sda1, by the way. They all appear under the "filesystem" icon.

You seem to want to:
  1. see sda4 as a separate disk in the Gnome file manager GUI and
  2. have sda4 mounted under a specific directory, /common-share

This would require telling Gnome where to mount it. I don't know how to do that, and if it is possible.
Or perhaps you keep things as they are now but manually create an icon for common-share.

gardenair 11-04-2015 05:36 AM

I am thankful to "suicidaleggroll" for his valuable guidance. :hattip: ,Appreciate you . :) thanks "berndbausch" as well.

suicidaleggroll 11-04-2015 11:53 AM

Quote:

Originally Posted by gardenair (Post 5444380)
Theoretically why it not show as a separate drive. I would be thankful if you kindly en-light on it.

This comes down to a fundamental difference between Linux and Windows.

In Windows, every drive is separate. They all have their own unique, individual hierarchy. C: has its own hierarchy, and D: has its own which is COMPLETELY separate from the one on C:. "My Computer" HAS to show you all of the drives and partitions on the system, because there is no other way to access them.

In Linux, there is ONE hierarchy that begins at /. EVERYTHING, all directories, all files, all drives, all partitions, are found in subdirectories of this ONE hierarchy. /home is /home, it will always be /home, it will always be located at /home, and you will always reference it as /home, but there's absolutely no requirement that /home lives on the same drive or partition as /, or any of the other directories in /. /home can live on a different partition, it can live on a different drive, it can even live on a different COMPUTER remote mounted through the local network or internet, yet it will still be located at /home in the hierarchy. Your new partition sda4 now lives at /common-share, that's its spot in the hierarchy, and anything placed in /common-share will end up on sda4.

Your sda4 partition isn't being shown to you in your DE because your DE is just showing you shortcuts to the mount locations of your non-integral drives. sda4 is now in fstab, it's mounted on boot and Gnome assumes that if you've put the drive in fstab, you intend for it to be permanently mounted in that location. It doesn't give you a shortcut to it because it assumes you already know where it's mounted, because you put it there. It also doesn't give you shortcuts for sda2 mounted at /, or sda1 mounted at /boot, or tmpfs mounted at /dev/shm, because these are integral partitions that are part of your system, and you should already know where they are if you need to access them. Gnome is only going to show you the temporary partitions/drives that are auto-mounted in unique locations that you might not know where to find.

gardenair 11-05-2015 10:13 PM

Once again I am really thankful to all especially "suicidaleggroll" that he guide me in a very good manner. Appreciate him. :hattip:


All times are GMT -5. The time now is 05:53 AM.