systemd: How do I automount a USB filesystem using /etc/fstab?

Clash Royale CLAN TAG#URR8PPP
up vote
11
down vote
favorite
I want my USB filesystems to automount when I connect the device.
How do I setup automount with systemd via /etc/fstab?
systemd autofs automounting
add a comment |Â
up vote
11
down vote
favorite
I want my USB filesystems to automount when I connect the device.
How do I setup automount with systemd via /etc/fstab?
systemd autofs automounting
add a comment |Â
up vote
11
down vote
favorite
up vote
11
down vote
favorite
I want my USB filesystems to automount when I connect the device.
How do I setup automount with systemd via /etc/fstab?
systemd autofs automounting
I want my USB filesystems to automount when I connect the device.
How do I setup automount with systemd via /etc/fstab?
systemd autofs automounting
systemd autofs automounting
edited Feb 28 '17 at 19:17
Martin Schröder
6041725
6041725
asked Feb 23 '17 at 7:39
Tom Hale
5,89922576
5,89922576
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
11
down vote
accepted
Connect your device and find out the UUID of the filesystem by running either blkid or lsblk -f.
Add a line to /etc/fstab such as:
UUID=05C5-A73A /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2
Then execute:
systemctl daemon-reload && systemctl restart local-fs.target
Explanation:
noauto- don't mount withmount -anofail- boot will continue even if this mount point is not mounted successfullyx-systemd.automounttellsystemdto automount this etnryx-systemd.idle-timeout=2- wait 2 seconds before unmounting the device after last usagex-systemd.device-timeout=2- wait only 2 seconds before givingNo such deviceif the device is not connected
Note:
- There are no quotes around the
UUIDnumber. - The mount point directory doesn't need to exist - it will be created
For more information about the options available, see systemd.mount(5)
2
Is there any advantage to this over audevrule? This seems very specific for a single device (given theUUID-dependency offstab), where audevrule could cover e.g. any USB flash drive.
â Fiximan
Feb 23 '17 at 9:52
/etc/fstabdoesn't have the dependency you assert, acceptingLABEL=...,PARTLABEL=...and good old/dev/usbkey. You could always setup audevrule to make/dev/usbkey, but I don't know how to mount usingudevalone.
â Tom Hale
Feb 23 '17 at 10:28
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
11
down vote
accepted
Connect your device and find out the UUID of the filesystem by running either blkid or lsblk -f.
Add a line to /etc/fstab such as:
UUID=05C5-A73A /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2
Then execute:
systemctl daemon-reload && systemctl restart local-fs.target
Explanation:
noauto- don't mount withmount -anofail- boot will continue even if this mount point is not mounted successfullyx-systemd.automounttellsystemdto automount this etnryx-systemd.idle-timeout=2- wait 2 seconds before unmounting the device after last usagex-systemd.device-timeout=2- wait only 2 seconds before givingNo such deviceif the device is not connected
Note:
- There are no quotes around the
UUIDnumber. - The mount point directory doesn't need to exist - it will be created
For more information about the options available, see systemd.mount(5)
2
Is there any advantage to this over audevrule? This seems very specific for a single device (given theUUID-dependency offstab), where audevrule could cover e.g. any USB flash drive.
â Fiximan
Feb 23 '17 at 9:52
/etc/fstabdoesn't have the dependency you assert, acceptingLABEL=...,PARTLABEL=...and good old/dev/usbkey. You could always setup audevrule to make/dev/usbkey, but I don't know how to mount usingudevalone.
â Tom Hale
Feb 23 '17 at 10:28
add a comment |Â
up vote
11
down vote
accepted
Connect your device and find out the UUID of the filesystem by running either blkid or lsblk -f.
Add a line to /etc/fstab such as:
UUID=05C5-A73A /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2
Then execute:
systemctl daemon-reload && systemctl restart local-fs.target
Explanation:
noauto- don't mount withmount -anofail- boot will continue even if this mount point is not mounted successfullyx-systemd.automounttellsystemdto automount this etnryx-systemd.idle-timeout=2- wait 2 seconds before unmounting the device after last usagex-systemd.device-timeout=2- wait only 2 seconds before givingNo such deviceif the device is not connected
Note:
- There are no quotes around the
UUIDnumber. - The mount point directory doesn't need to exist - it will be created
For more information about the options available, see systemd.mount(5)
2
Is there any advantage to this over audevrule? This seems very specific for a single device (given theUUID-dependency offstab), where audevrule could cover e.g. any USB flash drive.
â Fiximan
Feb 23 '17 at 9:52
/etc/fstabdoesn't have the dependency you assert, acceptingLABEL=...,PARTLABEL=...and good old/dev/usbkey. You could always setup audevrule to make/dev/usbkey, but I don't know how to mount usingudevalone.
â Tom Hale
Feb 23 '17 at 10:28
add a comment |Â
up vote
11
down vote
accepted
up vote
11
down vote
accepted
Connect your device and find out the UUID of the filesystem by running either blkid or lsblk -f.
Add a line to /etc/fstab such as:
UUID=05C5-A73A /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2
Then execute:
systemctl daemon-reload && systemctl restart local-fs.target
Explanation:
noauto- don't mount withmount -anofail- boot will continue even if this mount point is not mounted successfullyx-systemd.automounttellsystemdto automount this etnryx-systemd.idle-timeout=2- wait 2 seconds before unmounting the device after last usagex-systemd.device-timeout=2- wait only 2 seconds before givingNo such deviceif the device is not connected
Note:
- There are no quotes around the
UUIDnumber. - The mount point directory doesn't need to exist - it will be created
For more information about the options available, see systemd.mount(5)
Connect your device and find out the UUID of the filesystem by running either blkid or lsblk -f.
Add a line to /etc/fstab such as:
UUID=05C5-A73A /mnt/32GBkey vfat noauto,nofail,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.device-timeout=2
Then execute:
systemctl daemon-reload && systemctl restart local-fs.target
Explanation:
noauto- don't mount withmount -anofail- boot will continue even if this mount point is not mounted successfullyx-systemd.automounttellsystemdto automount this etnryx-systemd.idle-timeout=2- wait 2 seconds before unmounting the device after last usagex-systemd.device-timeout=2- wait only 2 seconds before givingNo such deviceif the device is not connected
Note:
- There are no quotes around the
UUIDnumber. - The mount point directory doesn't need to exist - it will be created
For more information about the options available, see systemd.mount(5)
edited Aug 13 at 11:32
Philippe Gachoud
363210
363210
answered Feb 23 '17 at 7:39
Tom Hale
5,89922576
5,89922576
2
Is there any advantage to this over audevrule? This seems very specific for a single device (given theUUID-dependency offstab), where audevrule could cover e.g. any USB flash drive.
â Fiximan
Feb 23 '17 at 9:52
/etc/fstabdoesn't have the dependency you assert, acceptingLABEL=...,PARTLABEL=...and good old/dev/usbkey. You could always setup audevrule to make/dev/usbkey, but I don't know how to mount usingudevalone.
â Tom Hale
Feb 23 '17 at 10:28
add a comment |Â
2
Is there any advantage to this over audevrule? This seems very specific for a single device (given theUUID-dependency offstab), where audevrule could cover e.g. any USB flash drive.
â Fiximan
Feb 23 '17 at 9:52
/etc/fstabdoesn't have the dependency you assert, acceptingLABEL=...,PARTLABEL=...and good old/dev/usbkey. You could always setup audevrule to make/dev/usbkey, but I don't know how to mount usingudevalone.
â Tom Hale
Feb 23 '17 at 10:28
2
2
Is there any advantage to this over a
udev rule? This seems very specific for a single device (given the UUID-dependency of fstab), where a udev rule could cover e.g. any USB flash drive.â Fiximan
Feb 23 '17 at 9:52
Is there any advantage to this over a
udev rule? This seems very specific for a single device (given the UUID-dependency of fstab), where a udev rule could cover e.g. any USB flash drive.â Fiximan
Feb 23 '17 at 9:52
/etc/fstab doesn't have the dependency you assert, accepting LABEL=..., PARTLABEL=... and good old /dev/usbkey. You could always setup a udev rule to make /dev/usbkey, but I don't know how to mount using udev alone.â Tom Hale
Feb 23 '17 at 10:28
/etc/fstab doesn't have the dependency you assert, accepting LABEL=..., PARTLABEL=... and good old /dev/usbkey. You could always setup a udev rule to make /dev/usbkey, but I don't know how to mount using udev alone.â Tom Hale
Feb 23 '17 at 10:28
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%2f347006%2fsystemd-how-do-i-automount-a-usb-filesystem-using-etc-fstab%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