Let's say I have a storage device called A.

I install A into my machine M1 (which contains a drive called B which is a unix boot drive containing the operating system).

I then boot up M1 and mount the drive into some directory.

I read / write to A in M1 for some time.

I then decide that I want to use the storage device A in another machine M2 (which contains a drive called C which is a unix boot drive containing the operating system much like before).

Will I be able to mount A to M2?

I would think so but I don't know all the specifics of UNIX file system management.

If the hypothetical I am giving is too general. Let's say the operating system on both drive C and B is Free BSD.

Also here's a bonus scenario: Let's say C contains ubuntu - is it still possible?

up vote 0 down vote accepted

This is certainly possible, and the intended use case for removable media. If your drive B contains a bootable Unix of some sort, it will contain a file tree rooted at /. That is why / is called the "root" directory. The on-disk structure of this file tree is determined by the filesystem in use.

In most cases, each drive (or each partition of each drive) will contain its own file tree; each has its own root directory. 1 When you mount a filesystem you identify its root directory with that of the mount point.

That is, if drive A appears as /dev/sdg, then after mount /dev/sdg /mnt, the /mnt directory points to the root of drive A (assuming your OS supports the filesystem and the mount succeeds). All operations under that directory take place on the filesystem of drive A and are completely independent of the filesystem of your system drive.


1 You can have a single filesystem that actually spreads over multiple independent drives, with e.g. RAID or ZFS, but these drives will then not be mounted individually. They will act as a single unit.

Yes, it is possible. You'll need to ensure both machines support the filesystem you format the drive with.

This is a common, everyday scenario. External HDD, flash media, etc.

  • Okay - The reason I ask this question is because I have read in some places that unix stored the "file directory tree" on only one storage device. So I thought if that one storage device was out of the picture another storage device would not be able to make heads or tails of the data on the mounted drive. – RH_delta Oct 17 at 5:04
  • @user316203 That is why we have virtual file system. – AmeyaVS Oct 17 at 5:08

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.