Sunday, April 24, 2016

Logical volumes and mounting partitions

When attaching a storage device (flash drive, external hard disk, etc) to a computer/operating system (OS), this is visible immediately. It is possible to check this physical presence by running fdisk -l. 

However, by attaching this device to the computer, this does not mean that I will be able to access to it straight away. This is because the OS is not aware of the filesystem (or directory tree) being used on this attached device, so the OS does not know how to see the information there, or access/write to it.

Therefore, it is necessary to mount this physical device by creating a logical access, and using a specific filesystem that is related to this device. As soon this happens, the OS can immediately read and write information here.

In other words
Physical device -> Set Filesystem type -> Mount Logical access -> OS can read it!


For example, when attaching an USB driver to my computer, and after running fdisk -l, I can see the physical device could be detected and this becomes physically available by what it shows in the below list:

 
I also will be able to see the driver listed in my Files as STORE N GO (name of the device):

I can also see precisely what are all the physical associations I have in the system, by running/ls -l /dev/disk/by-id:


If I only want to list all my USB devices, then I can run the command lsub:

 


Now, if I try to access to this (normally by simply doing a cd /media/aviola/STORE\ N\ GO, this driver will appear as non existent:


In order to make this accessible, I need then to mount this device. I can simply right click on the top of STORE N GO in Files, and then click in the option Mount.

If then I run the command mount in the Terminal, I will be able to see all the storage devices and their logical associations. I can see that /dev/sdb1 is now listed as /media/aviola/STORE N GO.

For umounting this drive again, I can use umount /media/aviola/S <double tab> to get the name completed (this is because there are some spaces and there is the need to use back slash before each space).

The easier way to mount a storage device is by using Files, but what if I want to have more control of what I am doing, and use a command line for that?

I can use the command mount and some parameters to make the logical access to this device available.

Initially I have to create a mount point. Before it was called STORE N GO under media/aviola. I will create something else in /media/external now with the command:
sudo mkdir /media/external

For then attaching the physical device to this mounting partition I can use:
mount /dev/sdb1 /media/external

I did not select any parameter such as if this device has a vfat or ntfs partition. I left the operating system decide that for me. By running mount I can see that the device was mounted correctly.


Please read the article called "Accessing to Files on Android device" for futher information to have access to USB connection using MTP.

Disabling automount

Kali comes with automount enabled by default. A simply test is by attaching an USB pen drive: if this gets automatically recognised as a storage system and you can have access directly to the content of it, then the automount is enabled.

Another way is to go to Files and when right clicking the USB storage system, the option Umount will appear in the list. 

The idea is to not have automount enabled due to a potential written access to the evidence accidentally. The storage system requires to be mounted with read only permissions, so an image can be created without altering the information sitting in this place.

In order to disable automount, please follow the below steps:
  1. Go to Terminal and open dconf Editor with the following command:
    dconf-editor (if this is not install, you have to run dconf-tools first).
  2. Once having the dconf Editor opened, select on the left side the schema org > gnome > desktop > media-handling option.
  3. Check if the options automount and automount-open are checked. The first option (automount) is for whether to automatically mount media. The second option (automount-open) is to whether to automatically open a folder for automounted media. I have disable these two:
  4. Also during this project, I am checking the option autorun-never. This is to never prompt or autorun/autostart programs when media are inserted.
If you do not want to install anything in your syste, it is possible to use the command gsettings and get the dconf keys changed manually.

The command to disable Nautilus automount:
gsettings set org.gnome.desktop.media-handling automount false for disabling, and true for enabling.

Enabling screenshot in Kali

  1. Go to Applications > Usual Applications > System Tools > Preferences > Settings:
  2. In All Settings screen, select option Keyboard under Hardware session:
  3. Go to Shortcuts tab, and select on the left right side option called Screenshots.
  4. check what is the shortcut selected and where files are being saved. Normally by default screenshots are saved automatically under Pictures:

Criteria for purchase

  1. Using only eBay, merely because the description of items seem to be more accurate, and because there is more control of how many items were sold by the seller, and what is the actually source of it. 
  2. Seller must not have too many sales (I started doing this from my 4th purchase). Having more than 200 sales would be an indicator that this is a company re-selling computers, therefore the methodology for putting these computers back to the market would most likely have a clean up process, that could destroy data. An example can be seen below:
  3.  It is being avoided purchasing computers that have the hard disk replaced or formatted, by the product's description. Example can be see below:

  4. Obviously, no purchases for laptops that do not contain hard disk: