USB hardrive auto mount

Post Reply
richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

USB hardrive auto mount

Post by richard-g8jvm »

Hi guys
sorry is stoopid question time again
Odroid XU4 running ubuntu 22, it was redundant and dong nothing but my girlfriend need a NAS, My USB harddrive is a

Code: Select all

Bus 004 Device 003: ID 0bc2:aa15 Seagate RSS LLC Basic
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0bc2 Seagate RSS LLC
  idProduct          0xaa15 
  bcdDevice            7.12
  iManufacturer           1 Seagate
  iProduct                2 Basic
  iSerial                 3 NABZ66N2

 
I followed the instructions in the article of Odroid Mag,https://magazine.odroid.com/article/set ... rpose-nas/
but stuck on the auto mounting , on my laptop running linux mint 21, plugging a WD USB hardrive , in the contents are shown in /media/richard
yet plugging this Seagate USB dive in to the XU4 shows nothing in /media/odroid, and nothing if I run "df -H",,, on my laptop its shown as sda1

Can someone help me get this Seagate RSS LLC USD drive to be used please
TIA
yet when the
BR
Richard G8JVM

User avatar
mctom
Posts: 2255
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 280 times
Been thanked: 368 times
Contact:

Re: USB hardrive auto mount

Post by mctom »

Mint automatically mounts plugged in USB drives, this is not generally what Linux does on its own.

If the drive is meant to be persistent (you won't ever unplug it), you can add entry to /etc/fstab that will mount it on startup.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

Hi the drive will be permanently connected, so adding to /etc/fstab will be fine
Obviously I dont want to screw up fstab ,,
where in the current file system am I like to find the UUID to use , and LABEL, I can probably format it as ext4 by plugging the USD drive in to this laptop,
IF I can format it ext4 will ubuntu 22 on the XU4 see it as a drive
BR
Richard G8JVM

User avatar
mctom
Posts: 2255
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 280 times
Been thanked: 368 times
Contact:

Re: USB hardrive auto mount

Post by mctom »

Those are good questions, I like it!

Yes, you can format the ext4 partitions on any other machine and it will be visible for XU4. Personally I use Gparted for that, too scared to do this in command line. :)
Formatting a partition will likely change its UUID so do it first. :)

Try this command to find out the partition UUID. The partition does not need to be mounted for this.

Code: Select all

lsblk -oNAME,SIZE,UUID
You don't need to know partition label, and it's recommended to use UUID in fstab for partition identification.

To work with fstab safely, copy it somewhere first. I did erase it once and it wasn't pleasant to restore it by hand. If you lose fstab for any reason, don't turn off the system until you restore it.
Just add a new line following the pattern from the previous entries.

You can apply fstab without reboot by issuing:

Code: Select all

sudo mount -a
Note the target directory (where your drive will be mounted to) should already exist (I think? Not sure about this but surely that won't hurt).
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mad_ady
Posts: 10956
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 996 times
Contact:

Re: USB hardrive auto mount

Post by mad_ady »

Yes, ext4 is the same across architectures.
But I don't recommend using fstab with a usb/removable drive, because there are some drawbacks:
- if the drive is not connected at boot, the system fails to boot, waiting for the drive
- if the drive disconnects and reconnects (either by accident/bad cable or because of user intervention), the mount point remains stale and needs to be manually unmounted (lazily) and remounted.

I'd recommend using autofs as described in the guide you referenced because it fixes the two issues above and adds a bonus - when the drive isn't accessed, it gets unmounted. This flushes data to disk and also leaves the filesystem in a clean state (e.g. you can remove the drive while idle without concern, or it will be clean in case of a power outage or crash). The cost is a slightly slower first access time, because the disk needs to get mounted, but since the disk may spin down anyway, you won't feel the extra delay.

An extra remark - Seagate drives didn't use to get along with the UAS driver. Check with lsusb -t what driver is attached to the disk. If it's UAS and you notice weird freezes/lockups or i/o errors, you may want to add usb quirks to the boot arguments of the kernel to force it in mass-storage mode.

User avatar
mctom
Posts: 2255
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 280 times
Been thanked: 368 times
Contact:

Re: USB hardrive auto mount

Post by mctom »

Ha, well then I guess I'll update my M1 server config and write a tutorial about it next weekend. :)

Thanks @mad_ady!
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

Thanks for the answers

Code: Select all

odroid@odroid:~$ lsblk -oNAME,SIZE,UUID
NAME          SIZE UUID
loop0        53.1M 
loop1       218.1M 
loop2         309M 
loop3           4K 
loop5        36.6M 
loop6        81.3M 
loop7        91.7M 
loop8       144.4M 
loop9        40.6M 
loop10       51.6M 
loop11       45.9M 
loop12         46M 
sda         931.5G 
└─sda1      931.5G 1EBE0B02BE0AD267
mmcblk1      29.7G 
├─mmcblk1p1   128M 52AA-6867
└─mmcblk1p2  29.6G e139ce78-9841-40fe-8823-96a304a09859

But I still haven't found where its mounted if mounted, not in /media I've looked in all directories

Code: Select all

odroid@odroid:~$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/2p, 5000M
        |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/2p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=exynos-ohci/3p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=exynos-ehci/3p, 480M


odroid@odroid:~$ lsusb
Bus 006 Device 002: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 004: ID 0bc2:aa15 Seagate RSS LLC Basic
Bus 004 Device 002: ID 05e3:0616 Genesys Logic, Inc. hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The Seagate drive is device 4,, very confused where is it hiding ??????
BR
Richard G8JVM

User avatar
mctom
Posts: 2255
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 280 times
Been thanked: 368 times
Contact:

Re: USB hardrive auto mount

Post by mctom »

It's not mounted yet, you have to mount it yourself. Both @mad_ady and me discussed two possible solutions of mounting it automatically.

At least now we learned its UUID is 1EBE0B02BE0AD267 (Odd.. is it ext4 already?)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

another problem with not being able to find where its been mounted is
in the guide

Code: Select all

$ sudo vi /etc/auto.master
# add at the end your mountpoint
/media/yourdisk /etc/auto.yourdisk --timeout 20
OK I dislike vi and use joe , but the only thing in /media is Boot, and its not there either

I have two USB drives , one's a WD passport 1 TB, which uses a different driver, the one I got today is the Seagate 1TB usb drive , which I prefer to use, both drives are NTFS
The end use is for my GF who has a windows laptops,, slow as hell with a horrible OS, and a Mac Iphone and Itablet, the use is to use what I'm trying to create is storage for the masses of photos and other video stuff, that Apple keep asking he to pay for cloud storage, its only really going to be her using it, it will also be running homeassistant to try and reduce the energy use in the home.
BR
Richard G8JVM

User avatar
mad_ady
Posts: 10956
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 996 times
Contact:

Re: USB hardrive auto mount

Post by mad_ady »

Ok, based on your output the disk is mounted as uas:
Port 2: Dev 4, If 0, Class=Mass Storage, Driver=uas, 5000M
For now leave it like this, but keep it in mind in case of weird behavior.

Based on your uuid, it looks like a ntfs drive. The advantage is it remains portable, but performance under linux will suffer. Makr sure to add big_writes to your mount option.

If your drive is currently mounted, you can find where by running mount | grep sda.
The path (/media/yourdrive) in /etc/autofs.conf points to a new directory (that autofs will create if I remember correctly), where your partitions will get mounted. Let's pick hdd as name. So, add:
/media/hdd /etc/auto.hdd --timeout=20
to your /etc/autofs.conf.

Next, you need to create an empty file with your favourite editor called /etc/auto.hdd, with the following contents (not sure about all the options):
seagate -fstype=ntfs,big_writes :UUID=your-uuid

Replace your-uuid with the actual uuid. Next, restart autofs sudo service autofs restart and you should be able to list /media/hdd/seagate.

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

Many Thanks,, sorry I didnt read the post from mctom properly,. I need to get a WiFi dongle for it as I dont know if my GF has wired lan ports available., So I'll take both the laptop and XU4 with me and play over there, and see how far I get . I'm not worried about portability too much so it could be reformated ext4
BR
Richard G8JVM

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

I've done everything suggested , but still not showing
I did type out a long reply with file contents shown, a chunk of dmesg, when to post it and the site logged me out aghhhhh !!!!!!!!
autofs is running

Code: Select all

726 ?        Ssl    0:00 /usr/sbin/automount --pid-file /var/run/autofs.pid

odroid@odroid:/media$ blkid
/dev/mmcblk1p2: LABEL="rootfs" UUID="e139ce78-9841-40fe-8823-96a304a09859" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3cedfd53-02"
/dev/loop1: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop8: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/mmcblk1p1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="52AA-6867" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="3cedfd53-01"
/dev/loop4: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop0: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/sda1: LABEL="Seagate Basic" BLOCK_SIZE="512" UUID="1EBE0B02BE0AD267" TYPE="ntfs" PARTUUID="9f6c6afc-01"
/dev/loop7: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"

odroid@odroid:/media$ df -H
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           209M  4.9M  204M   3% /run
/dev/mmcblk1p2   32G   12G   20G  39% /
tmpfs           1.1G     0  1.1G   0% /dev/shm
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk1p1  134M   20M  115M  15% /media/boot
tmpfs           209M  136k  209M   1% /run/user/121
tmpfs           209M  132k  209M   1% /run/user/1000

odroid@odroid:/media$ ls -l /dev/sda1
brw-rw---- 1 root disk 8, 1 Nov 23 12:06 /dev/sda1

So why on earth is it still hiding somewhere ????/

TIA
BR
Richard G8JVM

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

the drive is now ext4
UUID=00d7fa83-66e0-45eb-b602-a3a6cec1f750

changed /etc/auto.hdd to show this

Code: Select all

seagate - fstype=ext4,big_writes :UUID=00d7fa83-66e0-45eb-b602-a3a6cec1f750


blkid shows
/dev/sda1: UUID="00d7fa83-66e0-45eb-b602-a3a6cec1f750" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0f694851-01"

even tried adding to fstab, ran mount - a as root and no change

very weird
BR
Richard G8JVM

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

Now working with fstab, but refuses with autofs

Code: Select all

df
Filesystem     1K-blocks     Used Available Use% Mounted on
tmpfs             203920     4712    199208   3% /run
/dev/mmcblk1p2  30524364 11686232  18821748  39% /
tmpfs            1019584        0   1019584   0% /dev/shm
tmpfs               5120        4      5116   1% /run/lock
/dev/mmcblk1p1    130798    18730    112068  15% /media/boot
tmpfs             203916      132    203784   1% /run/user/121
tmpfs             203916      128    203788   1% /run/user/1000
/dev/sda1      960310188       28 911455776   1% /media/hdd

Now to try amd make it look like a cloud to the MAC and windows devices here, more help will be needed.
I wish Linux Mint was available for ARM devices , at least autofs works like a dream, instead of dreaming something might work,with ubuntu
BR
Richard G8JVM

richard-g8jvm
Posts: 479
Joined: Sun Jan 18, 2015 1:27 am
languages_spoken: english
ODROIDs: C1+ C2, XU4
Location: Telford UK
Has thanked: 0
Been thanked: 4 times
Contact:

Re: USB hardrive auto mount

Post by richard-g8jvm »

While this is still in the hardware section, where does Cups store printer connection info.
ie. When you set up a printerall the connection information stored.

The reason is this XU4 will also have to act as a print server, as the support for a Canon Mp560 has been dropped by Windows , but the XU4will be headless, so not so easy to set up a printer, and webmin is pretty useless with printer setup.
Thanks
BR
Richard G8JVM

User avatar
mad_ady
Posts: 10956
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 996 times
Contact:

Re: USB hardrive auto mount

Post by mad_ady »

So, for autofs I hope there is no space between "-" and fstype. Since you reformatted as ext4, you'll also need to remove the big_writes option. Otherwise, it looks good. You'll need to run at least ls -l /media/hdd/seagate for it to get mounted on demand. If it doesn't work, try creating /media/hdd (mkdir /media/hdd) and restarting autofs. To debug autofs issues you can run it in debug mode and it will print issues on the console: https://help.ubuntu.com/community/Autof ... t_Problems

For the printer, you install cups, and configure it to allow remote management: https://askubuntu.com/questions/23936/h ... -interface
Then use a browser and connect to https://odroid-ip:631/. Use the odroid root user/password to log in when asked. The rest of the steps should be intuitive.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 3 guests