3

I am trying to install Ubuntu 16.04 on my 24Gb integrated SanDisk iSSD with another secondary 500Gb drive, as answered in: How to boot Ubuntu from SSD drive which cannot be selected as boot device?

Even though gertvdijk's answer is great, I still cannot understand the symbolic links that he mentions.

I want to make some folders that uses much space, for example /sbin/ to store the information on the larger drive instead. Lets say I make /sbin/ a symbolic link to /folder/on/large/drive/ with: ln -s /sbin/ /folder/on/large/drive

Will this do the trick? If I would use apt-get install to install a program and apt want to place files in /sbin/ would it automatically be placed in /folder/on/large/drive instead?

Or would mount --bind /sbin/ /folder/on/large/drive work better?

kung
  • 295

1 Answers1

1

Short answer: Either one should work fine for that.

Longer answer: As long as everything works, they should function almost identically. The only difference would be in what happens if for some reason they don't work.

Think of a symbolic link like a "Shortcut" file. It's basically just a small file that tells you where to go next, and the OS (usually) handles that redirection for you automatically.

A mount, on the other hand, directly alters your view of the filesystem - whenever you request a file from a mounted directory, the kernel just silently hands you the actual file instead.

In the event that the target filesystem is ever unavailable, symlinks and mounts will behave differently. A symbolic link will point to a location that doesn't exist - and things will probably just start to throw errors. A mount, however, will immediately fail since there's no filesystem to mount. Then any attempts to read from or write to it will pass straight through to the (probably empty) directory that was supposed to be covered up by the mount.

Man pages: ln(1), mount(8)

All that being said, I would personally advise against moving any system-critical files (like /sbin) off the main drive. Moving /home (or some of its subdirectories) to a second drive, however, is a very common and accepted practice.