Category Archives: System/Adapters

Mount HFS+ as R/W without a MacOS

If you created a usb flash drive using MacOS, chances are you might have an HFS+ (journaled) file system device in your hands.

NOTE: If you do have a Mac sitting around, try this before.

In case you do not have access to a Mac, you may have to tweak a little to get your device working normally.

When you try to use your usb stick in Linux, you will have it mounted as a Read Only file system.

/dev/sdb3 on /media/dbkreling/dbkusb type hfsplus (ro,nosuid,nodev,uhelper=udisks2)

A filesystem check (fsck) did not work for me:

$ sudo fsck /dev/sdb3
fsck from util-linux 2.20.1
fsck: fsck.hfsplus: not found
fsck: error 2 while executing fsck.hfsplus for /dev/sdb3

Let’s install it then. The name of the package is hfsprogs:

$ sudo apt-get install hfsprogs

Preparing to unpack .../hfsprogs_332.25-11_amd64.deb ...
Unpacking hfsprogs (332.25-11) ...
Processing triggers for man-db ( ...
Setting up hfsprogs (332.25-11) ...

Now let’s try fsck again:

$ sudo fsck -f /dev/sdb3
fsck from util-linux 2.20.1
** /dev/sdb3
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume dbkusb appears to be OK.

Nice! Making progress… Then create a mounting point for it, other than the default one (without this step, I could not make it work, so make sure you do it):

$ mkdir /mnt/usb

Make sure the flash drive is unmounted and remount it at the new mount point, forcing r/w mode:

$ sudo umount /dev/sdb3
$ sudo mount -t hfsplus -o force,rw /dev/sdb3 /mnt/usb/
$ mount
/dev/sdb3 on /mnt/usb type hfsplus (rw,force)




dmidecode: Getting the serial number of your x86 system

The serial number of your system can be easily found on the bottom of your laptop in most of the systems. However, if you are working with a remote server and need to collect its info things get a little complicated. But fear not, for there is dmidecode to save your day.

From the man page:

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS) table
 contents in a human-readable format. This table contains a description of
 the system's hardware components, as well as other useful pieces of informa‐
 tion such as serial numbers and BIOS revision.(...)

So, give it a try and see what a plethora of information types you can see using a single command.

As for the serial number, issue:

$ sudo dmidecode -s system-serial-number

In my system:

$ sudo dmidecode -s system-serial-number
[sudo] password for dbkreling: 


Manage users on your system

This is a quick checklist on how to create a user from the command line:
1. useradd -m new_username (add a user called new_username with a home directory)
2. passwd new_username (set a password for new_username)
3. (optional) usermod -aG wheel new_username  (to include the user in the sudoers list)
4. su - new_username (to change to the new_username account)
NOTE: sudo usermod -a -G sudo username (to include user ‘username’ in the sudo group)


5. usermod -s /bin/bash NEW_USERNAME(to set the shell as bash. Change for other shells)

If you need to grant access to you system just for specific applications, you can tweak the visudo file. Using an admin user, issue:

  1. $ sudo visudocmnd_alias
  2. group the commands into aliases (line 18). List all commands you want to grant, separate by comma
  3. grant access to them (line 22). The ‘NOPASSWD’ will restrain to ask for a password for the minicom command. All the other commands ran with sudo will prompt for a password and will fail. To require password, do not include the ‘NOPASSWD’ tag.