LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Does umount command hides all the data in a partition ? (https://www.linuxquestions.org/questions/linux-newbie-8/does-umount-command-hides-all-the-data-in-a-partition-420983/)

sambyte 03-02-2006 12:17 PM

Does umount command hides all the data in a partition ?
 
Hi,

pls help me as i have a conceptual problem regarding the umount command.

Suppose i have a partition /dev/sda5 which has been mounted to /home. Now /dev/sda5 is the physical partition and /home is the logical partition.So the data that we see in /home actually resides on /dev/sda5.Now if i give a ommand like #umount /dev/sda5 that would imply that /home would be empty. But in my machine even aftr isuing this command
i cab still see some contents in /home. How ?

Secondly if /usr is formatted will the machine run all the applications after rstarting ?

marozsas 03-02-2006 12:49 PM

There is no such thing physical partition and logical partition. Only a disk partition, which could be primary or extended. (well, trehre is but in another context - LVM - which is not the case)

/dev/sda5 is a partition and /home is a mount point for /dev/sda5.

You can mount /dev/sda5 over any directory on the filesystem. The contents in that directory becomes "invisible" and you can only see the data that comes from the mounted partition. As soon you umount it, the original data in that directory is visible again.

The data you have in the mount point /home is result of some mistake you may have done before, like creating files, or starting a window manager without mounting /dev/sda5 first. It will be there forever until you remove it. If you do, make sure this time, the /dev/sda5 is not mounted otherwise you will remove the data from /dev/sda5 not from the underlying /home directory !

Quote:

Originally Posted by sambyte
Secondly if /usr is formatted will the machine run all the applications after rstarting ?

No. Very critical programs are in /usr, specially in /usr/sbin. The X windows system is under /usr/X11 just to mention one.

cheers,

haertig 03-02-2006 12:53 PM

Quote:

Originally Posted by sambyte
Now /dev/sda5 is the physical partition and /home is the logical partition.

Technically /dev/sda5 is the device associated with the first logical partition on the first harddrive, and /home is the mountpoint for this device.

Quote:

Now if i give a ommand like #umount /dev/sda5 that would imply that /home would be empty. But in my machine even aftr isuing this command i cab still see some contents in /home.
You would still be able to see the /home directory, but there shouldn't be anything in it. Unless there was something already there before you mounted /dev/sda5 over the top of it. The mount of /dev/sda5 would have hidden what was there before and the umount would have revealed it again. Mountpoints are generally empty directories to start with. Was yours?

Quote:

Secondly if /usr is formatted will the machine run all the applications after rstarting ?
I have no idea what you're asking here. "format" is like "wipe clean and start over". So any applications would be gone. Your system would not be very happy if you wiped out /usr. You could still boot to single-user mode, things wouldn't be totally dead, but neither would they be fully functional.

sambyte 03-02-2006 11:44 PM

Hi,
Thanks for your reply.i have almost got it. But still i have one more point to clear. Suppose i have unmounted /dev/sda5 . In that case the contents of /dev/sda5 would now be no longer visible in /home.If now at this juncture i create some files in /home where would be the files be saved ? Not in /dev/sda5
for sure ..... So is it going to be saved in / ?

Pls Help

Wim Sturkenboom 03-03-2006 12:57 AM

No, it's saved in the directory '/home' which is a subdirectory of '/'

pixellany 03-03-2006 01:23 AM

This may help:

1. All files and directories are stored in partitions--ie somewhere on a physical disk.

2. Partitions are mounted to the master directory tree. Instead of "mounted", read "attached"--may make it easier to follow.
In the simplest possible system, there is ONE partition mounted at /. This partition contains all of the sub-directories to /. If it were possible to unmount it without stopping the system, you would see **nothing** in the directory tree. (The reason, of course, that the system would crash is that IT would see nothing...)

3. When you mount a partition, you overlay its structure on top of whatever was associated with the mount point---thus all the files that you saw there now **appear** to be replaced by the newly mounted partition's structure. The old files and subdirectories are still there--they are just hidden. They are safe because you cannot access them to erase or modify. They could, however, also be safe from you ever finding them......;)

4. Based on the above, mounting a partition to anything but an empty directory can cause more confusion than most of us can deal with. Save yourself the grief and don't do it.....;)

sambyte 03-03-2006 11:24 PM

Hi,
Thanks all for your help


All times are GMT -5. The time now is 07:08 PM.