Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #186097 > unrolled thread
| Started by | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| First post | 2017-08-28 23:30 +0200 |
| Last post | 2017-09-03 04:00 +0200 |
| Articles | 14 — 6 participants |
Back to article view | Back to linux.debian.user
USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-28 23:30 +0200
Re: USB external hard drive -- mounting Ben Caradoc-Davies <ben@transient.nz> - 2017-08-29 01:10 +0200
Re: USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-29 02:20 +0200
Re: USB external hard drive -- mounting Ben Caradoc-Davies <ben@transient.nz> - 2017-08-29 03:40 +0200
Re: USB external hard drive -- mounting Frank <zuiderduin@gmx.com> - 2017-08-29 13:00 +0200
Re: USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-29 20:10 +0200
Re: USB external hard drive -- mounting Frank <zuiderduin@gmx.com> - 2017-08-29 21:40 +0200
Re: USB external hard drive -- mounting Mario Castelán Castro <marioxcc.MT@yandex.com> - 2017-08-29 04:40 +0200
Re: USB external hard drive -- mounting Dominique Dumont <dod38fr@gmail.com> - 2017-08-29 13:30 +0200
Re: USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-29 20:50 +0200
Re: USB external hard drive -- mounting Dominique Dumont <dod38fr@gmail.com> - 2017-08-29 21:10 +0200
Re: USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-29 21:20 +0200
Re: USB external hard drive -- mounting "James H. H. Lampert" <jamesl@touchtonecorp.com> - 2017-08-30 00:00 +0200
Re: USB external hard drive -- mounting Celejar <celejar@gmail.com> - 2017-09-03 04:00 +0200
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-28 23:30 +0200 |
| Subject | USB external hard drive -- mounting |
| Message-ID | <ujzLB-2eP-35@gated-at.bofh.it> |
Greetings: I'm in the process of setting up a new server, running Debian Jessie 8.9, replacing a Windows Server 2003 box (the same physical hardware). One of the functions of this server is to automatically (via a script run from cron) back up data (mostly on other servers, via FTP and SCP) from other servers in the network, to a USB external hard drive. I was pleasantly shocked when the NTFS-formatted USB drive auto-mounted as read/write, as soon as I plugged it in, without my having to apt-get anything. So far, I've got one of these auto-backup scripts working, after a fashion. But there are problems: because the external drive is currently auto-mounted, (1) the location of the drive in the file system is dependent on what user was signed on to the Gnome desktop when it auto-mounted, and (2) if no user signs on to the Gnome desktop, it doesn't get mounted anywhere. In addition, it mounts as "/media/<user>/Seagate Expansion Drive". Not only is this a bit of a mouthful when specifying a pathname in a script, and dependent on what user is signed on when it auto-mounts; it's also dependent on that physical drive (or another self-identifying the same), which would make swapping it out for a new drive potentially problematic. And when it is unmounted, the mountpoint goes away. I can't even determine *what* is doing the auto-mounting, and the more I read, the more confused I get: I see automount; I see usbmount; I see pmount; I've barely figured out how to see what packages are installed, and nothing jumps out at me as being what's auto-mounting the drive. Can anybody advise me on how to set this thing up so that if it's plugged in, it will mount, to a consistent mountpoint, whether anybody's signed on to Gnome or not? And when it's inevitably replaced, its replacement will continue to do so? -- James H. H. Lampert
[toc] | [next] | [standalone]
| From | Ben Caradoc-Davies <ben@transient.nz> |
|---|---|
| Date | 2017-08-29 01:10 +0200 |
| Message-ID | <ujBkm-3fm-5@gated-at.bofh.it> |
| In reply to | #186097 |
On 29/08/17 09:25, James H. H. Lampert wrote: > Can anybody advise me on how to set this thing up so that if it's > plugged in, it will mount, to a consistent mountpoint, whether anybody's > signed on to Gnome or not? I am not sure about the background automounting, but I get consistent mount points and mount settings with entries like these in /etc/fstab: LABEL=Backup /media/backup ext4 noatime,noauto,user,errors=remount-ro 0 0 LABEL=Thumb /media/thumb vfat noatime,noauto,user,uid=1000,gid=1000,umask=007,utf8,flush 0 0 The noauto and hardcoded uid/gid might not work for you, but they could be a starting point. Perhaps noauto to stop automounting plus a udev rule? I have not tried this. The above lines give me fixed mount points based on filesystem labels (LABEL), but UUID will also work. Device names are no good as they are by default dynamically assigned for USB storage devices. Kind regards, -- Ben Caradoc-Davies <ben@transient.nz> Director Transient Software Limited <http://transient.nz/> New Zealand
[toc] | [prev] | [next] | [standalone]
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-29 02:20 +0200 |
| Message-ID | <ujCq6-3Ti-3@gated-at.bofh.it> |
| In reply to | #186101 |
On 8/28/17, 4:07 PM, Ben Caradoc-Davies wrote: > I am not sure about the background automounting, but I get consistent > mount points and mount settings with entries like these in /etc/fstab: > > LABEL=Backup /media/backup ext4 > noatime,noauto,user,errors=remount-ro 0 0 . . . > The above lines give me fixed mount points based on filesystem labels > (LABEL). . . That got me started on an idea, even before I undertake anything with fstab. Thanks, Mr. Caradoc-Davies. First, I was able to relabel the drive as a suitably generic "ExternalHD," and when I unplugged it and plugged it back in, it mounted (albeit still under a user-specific, auto-created mount point) as that label. With the drive automounted, I did a "umount" on it, created a mount point for it (directly in /media, and available to everybody, for now, at least), and then did a "mount" at the new mount point. It mounted successfully in that user-neutral location, and is available to any signed-on user. Of course, if I then unmount it, pull the plug, and plug it back in, without an fstab entry, it auto-mounts to a created mount point in the user's subdirectory of /media, but at least the mount point I created doesn't go bye-bye, so that's a start. But I still need all the help I can get understanding this. -- JHHL
[toc] | [prev] | [next] | [standalone]
| From | Ben Caradoc-Davies <ben@transient.nz> |
|---|---|
| Date | 2017-08-29 03:40 +0200 |
| Message-ID | <ujDFv-4xu-5@gated-at.bofh.it> |
| In reply to | #186102 |
On 29/08/17 12:19, James H. H. Lampert wrote: > First, I was able to relabel the drive as a suitably generic > "ExternalHD," and when I unplugged it and plugged it back in, it mounted > (albeit still under a user-specific, auto-created mount point) as that > label. > With the drive automounted, I did a "umount" on it, created a mount > point for it (directly in /media, and available to everybody, for now, > at least), and then did a "mount" at the new mount point. It mounted > successfully in that user-neutral location, and is available to any > signed-on user. Permissions are likely to be main problem for multiuser access. User-private groups, the sgid bit, and careful selection of umask may help. > Of course, if I then unmount it, pull the plug, and plug it back in, > without an fstab entry, it auto-mounts to a created mount point in the > user's subdirectory of /media, but at least the mount point I created > doesn't go bye-bye, so that's a start. Good. This is the expected behaviour for media with labels. I have not tried this but a udev rule might be your next step: https://www.axllent.org/docs/view/auto-mounting-usb-storage/ There is also a thing called udisks, but I have not used that either. Kind regards, -- Ben Caradoc-Davies <ben@transient.nz> Director Transient Software Limited <http://transient.nz/> New Zealand
[toc] | [prev] | [next] | [standalone]
| From | Frank <zuiderduin@gmx.com> |
|---|---|
| Date | 2017-08-29 13:00 +0200 |
| Message-ID | <ujMps-1Ae-13@gated-at.bofh.it> |
| In reply to | #186103 |
Op 29-08-17 om 03:33 schreef Ben Caradoc-Davies:
> I have not tried this but a udev rule might be your next step:
> https://www.axllent.org/docs/view/auto-mounting-usb-storage/
That looks a lot more complicated than the solution I found a couple of
years ago (in a blog posting which - unfortunately - no longer
exists...). I also created a file in /etc/udev/rules.d/, but all it
contains is:
ENV{ID_FS_USAGE}=="filesystem|other|crypto",
ENV{UDISKS_FILESYSTEM_SHARED}="1"
(that's one line, in case it gets wrapped).
After udevadm control --reload (as root - and not --reload-rules as
mentioned in that axllent.org doc) udisks mounts indeed appear in /media
instead of /media/<user>.
> There is also a thing called udisks, but I have not used that either.
That's essentially what's used here.
Regards,
Frank
[toc] | [prev] | [next] | [standalone]
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-29 20:10 +0200 |
| Message-ID | <ujT7z-602-5@gated-at.bofh.it> |
| In reply to | #186122 |
On 8/29/17, 3:58 AM, Frank wrote:
> That looks a lot more complicated than the solution I found a couple of
> years ago (in a blog posting which - unfortunately - no longer
> exists...). I also created a file in /etc/udev/rules.d/, but all it
> contains is:
>
> ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
>
> (that's one line, in case it gets wrapped).
That seems to have had no effect whatsoever: it still doesn't auto-mount
until somebody signs on to Gnome, and when it does, it auto-mounts under
the user's subdirectory of /media, the same as before.
[toc] | [prev] | [next] | [standalone]
| From | Frank <zuiderduin@gmx.com> |
|---|---|
| Date | 2017-08-29 21:40 +0200 |
| Message-ID | <ujUwH-6Me-51@gated-at.bofh.it> |
| In reply to | #186149 |
Op 29-08-17 om 20:05 schreef James H. H. Lampert:
> On 8/29/17, 3:58 AM, Frank wrote:
>> That looks a lot more complicated than the solution I found a couple of
>> years ago (in a blog posting which - unfortunately - no longer
>> exists...). I also created a file in /etc/udev/rules.d/, but all it
>> contains is:
>>
>> ENV{ID_FS_USAGE}=="filesystem|other|crypto",
>> ENV{UDISKS_FILESYSTEM_SHARED}="1"
>>
>> (that's one line, in case it gets wrapped).
>
> That seems to have had no effect whatsoever: it still doesn't auto-mount
> until somebody signs on to Gnome, and when it does, it auto-mounts under
> the user's subdirectory of /media, the same as before.
That's odd. It has worked as intended here since 2015 (Xfce, currently
Debian Testing).
Regards,
Frank
[toc] | [prev] | [next] | [standalone]
| From | Mario Castelán Castro <marioxcc.MT@yandex.com> |
|---|---|
| Date | 2017-08-29 04:40 +0200 |
| Message-ID | <ujEBz-5eu-3@gated-at.bofh.it> |
| In reply to | #186101 |
[Multipart message — attachments visible in raw view] — view raw
On 28/08/17 18:07, Ben Caradoc-Davies wrote: > The above lines give me fixed mount points based on filesystem labels > (LABEL), but UUID will also work. Device names are no good as they are > by default dynamically assigned for USB storage devices. To complement the information given by Ben Caradoc-Davies: One can obtain the uuid with “ls -l /dev/disk/by-uuid/”. I can not be of more help. Regards. -- Do not eat animals, respect them as you respect people. https://duckduckgo.com/?q=how+to+(become+OR+eat)+vegan
[toc] | [prev] | [next] | [standalone]
| From | Dominique Dumont <dod38fr@gmail.com> |
|---|---|
| Date | 2017-08-29 13:30 +0200 |
| Message-ID | <ujMSv-1Zf-39@gated-at.bofh.it> |
| In reply to | #186097 |
On Monday, 28 August 2017 14:25:15 CEST James H. H. Lampert wrote: > Can anybody advise me on how to set this thing up so that if it's > plugged in, it will mount, to a consistent mountpoint, whether anybody's > signed on to Gnome or not? And when it's inevitably replaced, its > replacement will continue to do so? I wrote this blog a while ago for this kind of problem: https://ddumont.wordpress.com/2016/04/24/automount-usb-devices-with-systemd/ HTH -- https://github.com/dod38fr/ -o- http://search.cpan.org/~ddumont/ http://ddumont.wordpress.com/ -o- irc: dod at irc.debian.org
[toc] | [prev] | [next] | [standalone]
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-29 20:50 +0200 |
| Message-ID | <ujTKh-6eS-7@gated-at.bofh.it> |
| In reply to | #186123 |
On 8/29/17, 4:17 AM, Dominique Dumont wrote: > I wrote this blog a while ago for this kind of problem: > https://ddumont.wordpress.com/2016/04/24/automount-usb-devices-with-systemd/ That worked. It mounts on IPL, is available from an ssh session before anybody has signed on to Gnome, it mounts (after being unmounted) when unplugged and plugged back in, it mounts with a Gnome desktop icon, and it mounts as read/write, despite being NTFS. The fstab entries I came up with on the first try are: > LABEL=ExternalHD /media/ExternalHD auto defaults,noatime,auto,nofail 0 2 > LABEL=ExternalHD /media/ExternalHD auto defaults,x-systemd.automount,x-systemd.device-timeout=5,noatime,noauto 0 2 One odd thing, with those two lines in fstab, and a manually-inserted mount point of "ExternalHD" in /media, I get this message (I had to restart the box about 3 or 4 times in order to write it down verbatim) during the IPL process, before the screen blanks and (eventually) the Gnome sign-on screen comes up: > Failed to create mount unit file /run/systemd/generator/ > media-ExternalHD.mount as it already exists. Duplicate entry in > /etc/fstab? and also, contrary to the blog post, it doesn't, once unmounted, remount when one attempts to access it. None of these issues are of earth-shattering importance here, but I'm a bit curious about them. -- JHHL
[toc] | [prev] | [next] | [standalone]
| From | Dominique Dumont <dod38fr@gmail.com> |
|---|---|
| Date | 2017-08-29 21:10 +0200 |
| Message-ID | <ujU3D-6AB-1@gated-at.bofh.it> |
| In reply to | #186150 |
On Tuesday, 29 August 2017 11:46:34 CEST James H. H. Lampert wrote: > > LABEL=ExternalHD /media/ExternalHD auto defaults,noatime,auto,nofail 0 2 > > LABEL=ExternalHD /media/ExternalHD auto > > defaults,x-systemd.automount,x-systemd.device-timeout=5,noatime,noauto 0 > > 2 > One odd thing, with those two lines in fstab, and a manually-inserted > mount point of "ExternalHD" in /media, I get this message (I had to > restart the box about 3 or 4 times in order to write it down verbatim) > during the IPL process, before the screen blanks and (eventually) the > > Gnome sign-on screen comes up: > > Failed to create mount unit file /run/systemd/generator/ > > media-ExternalHD.mount as it already exists. Duplicate entry in > > /etc/fstab? Depending on the bahavior you want, you should choose one of the 2 lines, but not both. I believe the latter triggers the "Duplicate entry" warning . So if you want your device to be mounted when inserted, choose the line with defaults,noatime,auto,nofail If you want the device mounted when the mounted directory is accessed, choose the line with x-systemd.automount HTH -- https://github.com/dod38fr/ -o- http://search.cpan.org/~ddumont/ http://ddumont.wordpress.com/ -o- irc: dod at irc.debian.org
[toc] | [prev] | [next] | [standalone]
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-29 21:20 +0200 |
| Message-ID | <ujUdj-6Et-1@gated-at.bofh.it> |
| In reply to | #186151 |
On 8/29/17, 11:59 AM, Dominique Dumont wrote: > Depending on the bahavior you want, you should choose one of the 2 lines, but > not both. I believe the latter triggers the "Duplicate entry" warning . > > So if you want your device to be mounted when inserted, choose the line with > defaults,noatime,auto,nofail > > If you want the device mounted when the mounted directory is accessed, choose > the line with x-systemd.automount I see. Ok. That seems reasonable, although even on re-reading the blog entry, it still isn't clear (at least to one like me who doesn't often dig around in the guts of Linux), that it's an "either/or" situation, without your explanation above. Thanks for getting back to me. In my case, it's the first version. -- JHHL
[toc] | [prev] | [next] | [standalone]
| From | "James H. H. Lampert" <jamesl@touchtonecorp.com> |
|---|---|
| Date | 2017-08-30 00:00 +0200 |
| Message-ID | <ujWIc-84B-55@gated-at.bofh.it> |
| In reply to | #186151 |
Ok. As it stands now, I have only the "case 1" fstab entry in place, and after this line of the backup script: > cd /media/ExternalHD/Backups I've added these lines: > if [ "$?" = "1" ]; then > mount /media/ExternalHD > cd /media/ExternalHD/Backups > fi which (at least in theory) should mount the external drive if it's connected but not mounted. (And if it doesn't mount, then the backup gets built in the home directory instead, which is no big deal, since it's backing up something from a separate physical box.) Tonight, I'll leave ExternalHD connected but unmounted, and tomorrow morning, I'll see what will have happened. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | Celejar <celejar@gmail.com> |
|---|---|
| Date | 2017-09-03 04:00 +0200 |
| Message-ID | <ulsmC-230-9@gated-at.bofh.it> |
| In reply to | #186123 |
On Tue, 29 Aug 2017 13:17:31 +0200 Dominique Dumont <dod38fr@gmail.com> wrote: > On Monday, 28 August 2017 14:25:15 CEST James H. H. Lampert wrote: > > Can anybody advise me on how to set this thing up so that if it's > > plugged in, it will mount, to a consistent mountpoint, whether anybody's > > signed on to Gnome or not? And when it's inevitably replaced, its > > replacement will continue to do so? > > I wrote this blog a while ago for this kind of problem: > https://ddumont.wordpress.com/2016/04/24/automount-usb-devices-with-systemd/ Thanks for this. Following your post, I added a line like this to fstab: /dev/mapper/mydrive /media/mydrive ext4 defaults,user,nofail 0 0 It seems to work fine for automounting, but the problem is that it adds 90 seconds to the boot when the external drive is not present. The 'nofail' option allows the boot to eventually continue, but it only does so after a 90 second timeout is reached. The Arch wiki suggests adding "x-systemd.device-timeout=1" to solve this, but it seems like a bit of a kludge, and it will still add 1 second for each external drive that has an entry in fstab - not an ideal solution. https://wiki.archlinux.org/index.php/fstab#External_devices Celejar
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web