Mounting and Unmounting Storage

If you have a block device plugged in, and can view it in dmesg, you should be able to partition.

Mount partition 1 on /dev/sdb to /mnt

mount /dev/sdb1 /mnt

Unmount partition 1 on /dev/sdb

umount /dev/sdb1

Unmounting a “busy” partition
Say you try the above command and you get a device is busy, we can find out what’s accessing /dev/sdb1 with the fuser or lsof commands.

This will give the process id (PID) of the process that’s accessing /dev/sdb1

fuser -m /dev/sdb1

We can then find out what process is using it with the ps command.

ps auxww | grep $PID

Then we exit that program however we need to, exit from interface, kill it, kill -9 it, whatever and you will be able to unmount the partition.

Force unmount even when busy

umount -l /dev/sdb1

Remount read-only as read-write in maintenance mode
When something goes awry and you can’t boot into the OS to fix it, and you need to make an edit to get the machine to boot properly, you can be dropped into a maintenance mode by supplying the root password. The problem is, you can’t edit anything to fix the problem unless you remount the root partition as read-write.

mount -o remount,rw /