How to mount a drive without creating a directory?
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
When you plug a flashdrive into Ubuntu, it creates a directory in /media/<username>
with the flash drive name as the mount point name. When you unmount this directory, the directory cleanly goes away.
When you do mount <x>
on the command line you always require a mount point which must be an existing dir. How do you do it without creating the folder? There must be a way.
mount
add a comment |Â
up vote
-1
down vote
favorite
When you plug a flashdrive into Ubuntu, it creates a directory in /media/<username>
with the flash drive name as the mount point name. When you unmount this directory, the directory cleanly goes away.
When you do mount <x>
on the command line you always require a mount point which must be an existing dir. How do you do it without creating the folder? There must be a way.
mount
1
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
1
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
When you plug a flashdrive into Ubuntu, it creates a directory in /media/<username>
with the flash drive name as the mount point name. When you unmount this directory, the directory cleanly goes away.
When you do mount <x>
on the command line you always require a mount point which must be an existing dir. How do you do it without creating the folder? There must be a way.
mount
When you plug a flashdrive into Ubuntu, it creates a directory in /media/<username>
with the flash drive name as the mount point name. When you unmount this directory, the directory cleanly goes away.
When you do mount <x>
on the command line you always require a mount point which must be an existing dir. How do you do it without creating the folder? There must be a way.
mount
asked Dec 6 '17 at 7:39
James Dean
104
104
1
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
1
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20
add a comment |Â
1
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
1
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20
1
1
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
1
1
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20
add a comment |Â
6 Answers
6
active
oldest
votes
up vote
2
down vote
You always need a directory to use a mount point on a Unix-like system. There is software, e.g. automount
and udev
, that will automatically create the directory for you , but a directory must exist for the mount to actually occur.
add a comment |Â
up vote
1
down vote
Mounting a device means making its filesystem available through a specific directory (mountpoint) attached to the tree rooted at /
.
Therefore, you always need an already existing directory to use as a mountpoint. Without it, you would not be able to access the mounted device.
Note that the directory used as mountpoint doesn't need to be empty; however, its old contents would be made inaccessible after the mount. For this reason, and to avoid confusion, usually devices are mounted on empty directories.
@Kusalananda's answer provides a function that makes the creation of the mountpoint automatic and transparent to the user, but under the hood the directory must always exist.
add a comment |Â
up vote
1
down vote
No , it is not possible to mount a device without creating a mount point, " the mount
command require a mount point" :
mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir
man mount
add a comment |Â
up vote
0
down vote
There must be a way.
No, there is no way.
How do you do it without creating the folder?
There has to be some directory given to mount
as a mount point.
Maybe you asked bad. But I personally don't see any logic in your question.
add a comment |Â
up vote
0
down vote
mymount ()
On most Unices, with most file systems, the mount
utility requires that the mountpoint be an existing directory.
With the bash
shell function above, this directory is created if it does not already exist. The mountpoint is assumed to be the last argument on the command line when invoking the function. This allows you to mount a device anywhere without manually creating the mountpoint.
This is probably somewhat like whatever it is that creates the /media/username
mountpoint on your system does.
Likewise, you could define myumount
that unmounted a device and removed its mountpoint.
This obviously does not get around the fact that the directory can't be created by mount
(or deleted by umount
), at least not by the mount
implementations that I know about, but it allows you to hide the creation of the directory in a function.
Unix philosophy: Do one thing and do it well.
mount
requires a directory to mount something at. Creating this directory is the task for mkdir
.
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
add a comment |Â
up vote
0
down vote
You left unclear what you want to achieve and why you can't create a mountpoint dir, making this is a typical XY question.
If your main issue is to temporarily mount a drive without having to create and clean up the mountpoint, then you may use /mnt
which is designated to this purpose by the Filesystem Hierarchy Standard. It is discouraged to use /mnt
for long-term/permanent mounting.
add a comment |Â
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You always need a directory to use a mount point on a Unix-like system. There is software, e.g. automount
and udev
, that will automatically create the directory for you , but a directory must exist for the mount to actually occur.
add a comment |Â
up vote
2
down vote
You always need a directory to use a mount point on a Unix-like system. There is software, e.g. automount
and udev
, that will automatically create the directory for you , but a directory must exist for the mount to actually occur.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You always need a directory to use a mount point on a Unix-like system. There is software, e.g. automount
and udev
, that will automatically create the directory for you , but a directory must exist for the mount to actually occur.
You always need a directory to use a mount point on a Unix-like system. There is software, e.g. automount
and udev
, that will automatically create the directory for you , but a directory must exist for the mount to actually occur.
answered Dec 6 '17 at 8:48
fpmurphy1
2,231915
2,231915
add a comment |Â
add a comment |Â
up vote
1
down vote
Mounting a device means making its filesystem available through a specific directory (mountpoint) attached to the tree rooted at /
.
Therefore, you always need an already existing directory to use as a mountpoint. Without it, you would not be able to access the mounted device.
Note that the directory used as mountpoint doesn't need to be empty; however, its old contents would be made inaccessible after the mount. For this reason, and to avoid confusion, usually devices are mounted on empty directories.
@Kusalananda's answer provides a function that makes the creation of the mountpoint automatic and transparent to the user, but under the hood the directory must always exist.
add a comment |Â
up vote
1
down vote
Mounting a device means making its filesystem available through a specific directory (mountpoint) attached to the tree rooted at /
.
Therefore, you always need an already existing directory to use as a mountpoint. Without it, you would not be able to access the mounted device.
Note that the directory used as mountpoint doesn't need to be empty; however, its old contents would be made inaccessible after the mount. For this reason, and to avoid confusion, usually devices are mounted on empty directories.
@Kusalananda's answer provides a function that makes the creation of the mountpoint automatic and transparent to the user, but under the hood the directory must always exist.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Mounting a device means making its filesystem available through a specific directory (mountpoint) attached to the tree rooted at /
.
Therefore, you always need an already existing directory to use as a mountpoint. Without it, you would not be able to access the mounted device.
Note that the directory used as mountpoint doesn't need to be empty; however, its old contents would be made inaccessible after the mount. For this reason, and to avoid confusion, usually devices are mounted on empty directories.
@Kusalananda's answer provides a function that makes the creation of the mountpoint automatic and transparent to the user, but under the hood the directory must always exist.
Mounting a device means making its filesystem available through a specific directory (mountpoint) attached to the tree rooted at /
.
Therefore, you always need an already existing directory to use as a mountpoint. Without it, you would not be able to access the mounted device.
Note that the directory used as mountpoint doesn't need to be empty; however, its old contents would be made inaccessible after the mount. For this reason, and to avoid confusion, usually devices are mounted on empty directories.
@Kusalananda's answer provides a function that makes the creation of the mountpoint automatic and transparent to the user, but under the hood the directory must always exist.
answered Dec 6 '17 at 8:38
dr01
15.3k114769
15.3k114769
add a comment |Â
add a comment |Â
up vote
1
down vote
No , it is not possible to mount a device without creating a mount point, " the mount
command require a mount point" :
mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir
man mount
add a comment |Â
up vote
1
down vote
No , it is not possible to mount a device without creating a mount point, " the mount
command require a mount point" :
mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir
man mount
add a comment |Â
up vote
1
down vote
up vote
1
down vote
No , it is not possible to mount a device without creating a mount point, " the mount
command require a mount point" :
mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir
man mount
No , it is not possible to mount a device without creating a mount point, " the mount
command require a mount point" :
mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir
man mount
answered Dec 6 '17 at 8:53
GAD3R
22.6k154894
22.6k154894
add a comment |Â
add a comment |Â
up vote
0
down vote
There must be a way.
No, there is no way.
How do you do it without creating the folder?
There has to be some directory given to mount
as a mount point.
Maybe you asked bad. But I personally don't see any logic in your question.
add a comment |Â
up vote
0
down vote
There must be a way.
No, there is no way.
How do you do it without creating the folder?
There has to be some directory given to mount
as a mount point.
Maybe you asked bad. But I personally don't see any logic in your question.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
There must be a way.
No, there is no way.
How do you do it without creating the folder?
There has to be some directory given to mount
as a mount point.
Maybe you asked bad. But I personally don't see any logic in your question.
There must be a way.
No, there is no way.
How do you do it without creating the folder?
There has to be some directory given to mount
as a mount point.
Maybe you asked bad. But I personally don't see any logic in your question.
answered Dec 6 '17 at 8:35
Vlastimil
6,4411147119
6,4411147119
add a comment |Â
add a comment |Â
up vote
0
down vote
mymount ()
On most Unices, with most file systems, the mount
utility requires that the mountpoint be an existing directory.
With the bash
shell function above, this directory is created if it does not already exist. The mountpoint is assumed to be the last argument on the command line when invoking the function. This allows you to mount a device anywhere without manually creating the mountpoint.
This is probably somewhat like whatever it is that creates the /media/username
mountpoint on your system does.
Likewise, you could define myumount
that unmounted a device and removed its mountpoint.
This obviously does not get around the fact that the directory can't be created by mount
(or deleted by umount
), at least not by the mount
implementations that I know about, but it allows you to hide the creation of the directory in a function.
Unix philosophy: Do one thing and do it well.
mount
requires a directory to mount something at. Creating this directory is the task for mkdir
.
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
add a comment |Â
up vote
0
down vote
mymount ()
On most Unices, with most file systems, the mount
utility requires that the mountpoint be an existing directory.
With the bash
shell function above, this directory is created if it does not already exist. The mountpoint is assumed to be the last argument on the command line when invoking the function. This allows you to mount a device anywhere without manually creating the mountpoint.
This is probably somewhat like whatever it is that creates the /media/username
mountpoint on your system does.
Likewise, you could define myumount
that unmounted a device and removed its mountpoint.
This obviously does not get around the fact that the directory can't be created by mount
(or deleted by umount
), at least not by the mount
implementations that I know about, but it allows you to hide the creation of the directory in a function.
Unix philosophy: Do one thing and do it well.
mount
requires a directory to mount something at. Creating this directory is the task for mkdir
.
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
add a comment |Â
up vote
0
down vote
up vote
0
down vote
mymount ()
On most Unices, with most file systems, the mount
utility requires that the mountpoint be an existing directory.
With the bash
shell function above, this directory is created if it does not already exist. The mountpoint is assumed to be the last argument on the command line when invoking the function. This allows you to mount a device anywhere without manually creating the mountpoint.
This is probably somewhat like whatever it is that creates the /media/username
mountpoint on your system does.
Likewise, you could define myumount
that unmounted a device and removed its mountpoint.
This obviously does not get around the fact that the directory can't be created by mount
(or deleted by umount
), at least not by the mount
implementations that I know about, but it allows you to hide the creation of the directory in a function.
Unix philosophy: Do one thing and do it well.
mount
requires a directory to mount something at. Creating this directory is the task for mkdir
.
mymount ()
On most Unices, with most file systems, the mount
utility requires that the mountpoint be an existing directory.
With the bash
shell function above, this directory is created if it does not already exist. The mountpoint is assumed to be the last argument on the command line when invoking the function. This allows you to mount a device anywhere without manually creating the mountpoint.
This is probably somewhat like whatever it is that creates the /media/username
mountpoint on your system does.
Likewise, you could define myumount
that unmounted a device and removed its mountpoint.
This obviously does not get around the fact that the directory can't be created by mount
(or deleted by umount
), at least not by the mount
implementations that I know about, but it allows you to hide the creation of the directory in a function.
Unix philosophy: Do one thing and do it well.
mount
requires a directory to mount something at. Creating this directory is the task for mkdir
.
edited Dec 6 '17 at 9:51
answered Dec 6 '17 at 8:16
Kusalananda
104k14206324
104k14206324
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
add a comment |Â
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
4
4
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
Your answer does not meet the OPs requirement, i.e. without creating a directory
â fpmurphy1
Dec 6 '17 at 8:23
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
@fpmurphy1 Can't be done in the general case, which is what I wrote. I then created a function that encapsulates the creation of the directory, so that it doesn't need to be created manually.
â Kusalananda
Dec 6 '17 at 8:31
add a comment |Â
up vote
0
down vote
You left unclear what you want to achieve and why you can't create a mountpoint dir, making this is a typical XY question.
If your main issue is to temporarily mount a drive without having to create and clean up the mountpoint, then you may use /mnt
which is designated to this purpose by the Filesystem Hierarchy Standard. It is discouraged to use /mnt
for long-term/permanent mounting.
add a comment |Â
up vote
0
down vote
You left unclear what you want to achieve and why you can't create a mountpoint dir, making this is a typical XY question.
If your main issue is to temporarily mount a drive without having to create and clean up the mountpoint, then you may use /mnt
which is designated to this purpose by the Filesystem Hierarchy Standard. It is discouraged to use /mnt
for long-term/permanent mounting.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You left unclear what you want to achieve and why you can't create a mountpoint dir, making this is a typical XY question.
If your main issue is to temporarily mount a drive without having to create and clean up the mountpoint, then you may use /mnt
which is designated to this purpose by the Filesystem Hierarchy Standard. It is discouraged to use /mnt
for long-term/permanent mounting.
You left unclear what you want to achieve and why you can't create a mountpoint dir, making this is a typical XY question.
If your main issue is to temporarily mount a drive without having to create and clean up the mountpoint, then you may use /mnt
which is designated to this purpose by the Filesystem Hierarchy Standard. It is discouraged to use /mnt
for long-term/permanent mounting.
answered Dec 6 '17 at 12:18
Murphy
1,7471517
1,7471517
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409120%2fhow-to-mount-a-drive-without-creating-a-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
I suppose "use an existing directory" is not a very satisfying answer? You do need to have some directory to mount to.
â ilkkachu
Dec 6 '17 at 8:15
1
Oh, why must it be possible to mount without a mount point?
â fpmurphy1
Dec 6 '17 at 8:20