1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Mount two USB disks by label ([email protected]_2)

Discussion in 'Asuswrt-Merlin' started by sashabe, Jul 14, 2019.

  1. sashabe

    sashabe New Around Here

    Joined:
    Jun 26, 2019
    Messages:
    4
    I've bought an RT-AC86U and have 384.11_2 AsusWRT Merlin installed on it. I've got two disks, a HDD and a USB3.0-enabled SSD. The HDD has just one HFS+ partition (sda1, used for Time Machine). The SSD is partitioned into two partitions, one HFS+ (sdb1, used for general file storage) and another ext4 (sdb2, used for entware and swap file). I want the SSD to always stay sdb* since I'd like to disconnect it from time to time from the router and view/modify the contents of the HFS partition on a Mac directly.
    Recently I have had some problems with the disks connected on reboot in a wrong order. HDD becomes sdb1 and SSD becomes sda1 and sda2, which obviously breaks some stuff. The solution is said to be labelling the partitions an mounting them by label. How can this be done? Do I need to edit the jffs scripts for that? The partitions are labelled right now — HFS+ partitions through Mac's Finder and ext4 through tune2fs.

    This is what blkid is showing now:

    /dev/sdb2: LABEL="ENTWARE" UUID="e4b28958-ff35-4e4f-844b-6fe6d48c167e"
    /dev/sdb1: LABEL="RFASTDOCS" UUID="5c92871d-2d29-38a9-ade8-dc1fb9e0fecf"
    /dev/sda1: LABEL="RouterHDD" UUID="905fe806-f71e-333d-bfb2-fe531254b94f"

    Thanks!
     
  2. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,326
    Location:
    UK
    You can't control the device names generated by the router (e.g. /dev/sda1 or /dev/sdb2). However, if the partition has a valid label then it will use it to create a consistent mount point (e.g. /tmp/mnt/RouterHDD or /tmp/mnt/ENTWARE).
     
    Last edited: Jul 14, 2019
  3. sashabe

    sashabe New Around Here

    Joined:
    Jun 26, 2019
    Messages:
    4
    Thanks! I've added the label to the ext4 partition with tune2fs, and now, if i cd && ls to /tmp/mnt, i see the ext4 partition has been mounted by its label. The 2 partitions in HFS+ are still mounted by device names (/tmp/mnt/sda1, /tmp/mnt/sdb1). Is there a way I make the system use the labels that the HFS+ partitions have?
     
  4. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,326
    Location:
    UK
    Sorry, I don't know why it's not mounting it, I'm not a mac guy. All I know is that it worked for me in testing when I formatted devices using the router's own hfs commands.

    You said in post #1 that your devices were labelled, even the ext4 device. But from post #3 we can see that must not have been the case (at least for the ext4 device). I would double check that the hfs devices really do contain a label.
     
  5. RAH-66

    RAH-66 Regular Contributor

    Joined:
    Sep 1, 2018
    Messages:
    53
    mount by lable, example for your SSD

    mkdir /tmp/mnt/rfastdocs
    mount LABEL="RFASTDOCS" /tmp/mnt/rfastdocs

    mkdir /tmp/mnt/entware
    mount LABEL="ENTWARE" /tmp/mnt/entware
     
    luckyseven likes this.
  6. sashabe

    sashabe New Around Here

    Joined:
    Jun 26, 2019
    Messages:
    4
    It seems you can't label an HFS+ partition with tune2fs, that utility only works with ext* partitions. Therefore it's not possible to mount an HFS+ partition by label. The label that blkid displays is not the label you can use to mount the partition (it comes from HFS+).

    So I ended up reformatting the Time Machine partition (/dev/sda1) from HFS+ to ext4. The good thing is that Time Machine actually supports ext4 for a network drive (probably it supports any FS that the networking device would support, though it's not clear from the official help).

    Hence I now have these partitions (mount command output):

    /dev/sdb2 on /tmp/mnt/ENTWARE type ext4 (SSD/USB3, for Entware)
    /dev/sda1 on /tmp/mnt/ROUTERHDD type ext4 (HDD/USB2, for TM)
    /dev/sdb1 on /tmp/mnt/sdb1 type thfsplus (SSD/USB3, for general files)

    I hope that now that 2 out of 3 partitions are mounted by label, this situation with mount points changing from time to time won't happen again. Time will show...
    If I ever have this problem, I will experiment with mounting the last partition not by label but by UUID (I'd prefer to still have it formatted as HFS+ instead of ext4, which is unreadable under both OS X/Win if connected via USB).
     
  7. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,326
    Location:
    UK
    I don't know of a way of adding a label to an already formatted HFS+ filesystem, but when I was testing stuff for amtm I could create a label as part of the formatting process on the router.
    Code:
    newfs_hfs -v HFS_VOLUME_NAME /dev/sdb1
    The exact command might vary depending on the model of router you're using.
     
  8. sashabe

    sashabe New Around Here

    Joined:
    Jun 26, 2019
    Messages:
    4
    Oh, cool! I did not know you can format as HFS on router itself, thanks for the tip.
    The question is, can we use the HFS label to create a mount point? As I got to understand it, you cannot, but i might be wrong.
     
  9. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    10,326
    Location:
    UK
    That's what I was doing in all my testing. YMMV.