Monday, October 31, 2016

Adding disks to an LVM

One of my virtual machines ran out of disk space the other day because I wasn't sure of disk sizing when I initially started playing with it. The solution was simple the LVM had to be extended. This is how you do it:

  1. sudo apt-get install system-config-lvm
  2. sudo pvcreate /dev/your_disk
  3. sudo vgextend VG_Name /dev/your_disk
  4. sudo lvextend -1 +100%FREE LV_PATH 
  5. sudo resize2fs LV_PATH
  6. sudo init 6
That is it, simple right?

To determine the disk(s) you want to add you do ls /dev/sd* it will return your disks, you will probably want to add the disks with no numbers at the end.

To figure out your volume group (VG_NAME) you do sudo vgdisplay and to figure out the logical volume path (LV_PATH) you do sudo lvdisplay.

Monday, October 17, 2016

Virtualbox guest additions on ubuntu

When I want to try something out I often use a virtualbox to play in. My guest operating system is often an Ubuntu. One of the things you want to do is share a folder with the guest operating system and thus you need to install the virtualbox guest additions.

Where in the past I use to work with the additions CD-rom, I now use the package that Ubuntu offers called virtualbox-guest-additions-iso. It is important to be aware about the fact that Ubuntu has split things up a bit and thus you have other packages to install too if you need some functionalities like vitualbox-guest-dkms, virtualbox-guest-x11 and virtualbox-guest-utils.

These virtualbox-guest packages are DKMS aware, which means that they can update without changing the whole kernel.

A common operation is to share a directory with the virtual machine. You do this by setting up a directory and permanently mounting it. It will be mounted in /media.

Monday, October 3, 2016

Can you hack my mac?

A couple of weeks back this was the question I got by text message. It was from a friend who had some issues and asked one of his other friends to have a look at it and since then he was totally locked out.

This is the procedure I used to access his Mac.

Removing the setup file.
I booted the system with the command (that weird Apple key for Windows users) + S. This boots the system into single user mode and gives back a terminal.

Next I did a file system check with fsck -fy. The file system was ok.
The following step was to mount the root drive as writable:
mount -uw /

Finally I renamed the .AppleSetupDone
mv /var/db/.AppleSetupDone /var/db/.AppleSetupDone.old

Creating a new Admin.
After the reboot the "Welcome wizard" screen came on, I made a new account, which automatically made me an Admin account.

Reset of the old Admin's password.
The only thing left to do was reset the old admin password. This is done via the system preferences, accounts. You have to unlock the little lock icon at the bottom, and reset the original Admin account.

I logged out of the new admin and logged my friend in to his familiar session.