What's new

Drive gets different mount points after reboot

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

SSovets

Occasional Visitor
I have set up a partition on a flash drive for swap, but the drive gets different mount points (I hope I make myself clear, I'm not very familiar with this terminology) after each reboot. Now it's /dev/sdb1, before the last reboot /dev/sda1, before that - /dev/sdc1 (I have 3 hard drives attached to the router at the moment). How can I make it stick to one mount point, so that I can define a swapon in post-mount.conf?
 
Label the partitions and then it will use that rather than the generic sdx name which will change depending on the order the drives mount in


Sent from my iPhone using Tapatalk
 
Thanks for the suggestion, but it seems I am unable, for some reason, to assign a label to the swap partition. The only command that I found should work is mkswap with the -L option, but it seems to skip setting the label, as I do not get the "LABEL=" result, only the "size=" and "UUID=". Any ideas what I might be doing wrong?
 
Dumping the partition header we can see that the label is stored there correctly. Unfortunately Busybox's swapon command doesn't support the label option. ****

However, if you create an appropriate entry in fstab (using /jffs/configs/fstab) it will activate it when the router boots up, or when "swapon -a" is run.


EDIT: Most people here don't use a separate swap partition. Instead they just use a swap file which can be created in any mounted filesystem and can easily be turned on and off with the swapon and swapoff commands. It also makes it much easier to change its size if you need to.

P.S. You could also use the UUID in the fstab instead of a label. Either will work.


**** UPDATE: OK, it's not actually documented but Busybox's swapon and swapoff do support LABEL and UUID. The syntax is a bit cryptic though:
Code:
# swapon UUID=626313d1-bfc8-4618-b496-f40d5ed00c9e
# swapoff UUID=626313d1-bfc8-4618-b496-f40d5ed00c9e
Code:
# swapon LABEL=myswap
# swapoff LABEL=myswap
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top