2

I have ubuntu on a 32GB USB2 flash stick that I carry around with me, it works fine booting on other machines I have to sometimes access.

Recently I added a volume that contains a lot of data (a 500GB disk) to my fstab so I can access it on one of the computers.

It is mounted with the options defaults,noatime,commit=300,autodefrag as I want these switches when mounting. If I boot from another computer, the drive is missing so I get dropped to a recovery console and have to comment out that line on the fstab and reboot.

I normally work around this by having 2 user accounts, one for "home" and one for "away", and mount the disk on autologin items for one account and not the other.

The command I use to mount for my "home" account is:

udisksctl mount --block-device /dev/sda1

However this is missing the switches I want. (defaults,noatime,commit=300,autodefrag)

Is there a way to parse these switches into the mount command via the CLI for a btrfs volume?

Kind regards Pete

1 Answer 1

3

If you want to use udisksctl, you can use the --options flag to specify what options to mount with. In your case, the command will be udisksctl mount --block-device /dev/sda1 --options "defaults,noatime,commit=300,autodefrag" (the quotes might not be needed, but they are there just to be safe).

Note that only safe options will be passed through to the mount command; options such as suid and dev will be rejected. (See also the man page for udisksctl.)

That being said, you might want to modify your /etc/fstab file so that the 500GB file isn't considered "important" enough to stop booting. Using the nofail and/or nobootwait options might help here.

2
  • That is awesome, thanks it works and mounts correctly. Thanks for the tip on nofail for fstab, although in this instance I prefer the udiskctrl method. I was able to verify that this answer is 100% correct by using this command : cat /proc/mounts The relevant output was: /dev/sda1 /media/aragorn/Internal btrfs rw,noatime,space_cache,autodefrag,commit=300 0 0 Which was desired :)
    – allebone
    Commented Jun 29, 2015 at 6:08
  • After some testing, I found your other tip on using "nobootwait" in the options section of the FSTAB to be better, and have less restrictions. I am actually thinking this is a better option all around as it makes the entire setup simpler. Thanks for that tip :)
    – allebone
    Commented Jun 29, 2015 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .