You will find more details here: http://www.dedoimedo.com/computers/vlc-streaming.html
Thursday, December 22, 2016
Copying streams to video/audio files using vlc
You will find more details here: http://www.dedoimedo.com/computers/vlc-streaming.html
Wednesday, December 7, 2016
Wifi analyzer
NetworkManager has got you covered. Just execute:
nmcli d wifi
on your linux console and you are done.
Saturday, November 26, 2016
Gimp and rule of thirds guides
Here is a simple guide that works just fine: http://registry.gimp.org/node/13536
Friday, November 25, 2016
Realtek gigabit usb ethernet card with usb hub
[ 265.335354] usb 1-1.1.3: Manufacturer: Realtek
[ 265.335358] usb 1-1.1.3: SerialNumber: 00E14C3600C8
[ 265.428826] usb 1-1.1.3: reset high-speed USB device number 19 using ehci-pci
[ 265.567413] r8152 1-1.1.3:1.0 eth1: v1.08.2
[ 267.113732] r8152 1-1.1.3:1.0 enx00e14c3600c8: renamed from eth1
[ 267.139576] IPv6: ADDRCONF(NETDEV_UP): enx00e14c3600c8: link is not ready
[ 267.197045] IPv6: ADDRCONF(NETDEV_UP): enx00e14c3600c8: link is not ready
Typing the € symbol in a linux system
If you use English (US) keyboard layout and you don't want to change it, the the fastest way would be to use Ctrl+Shift+U key combination and then type
20ac
followed by Space(or
Enter) which will turn into €
.The Xorg solution:
In your keyboard layout settings choose Options -> Add currency signs to certain keys then choose the key you can use to activate that option by changing the option Key to choose 3rd level (or 4th depending on which level your currency symbol is. you can get the full keycodes by using xmodmap -pke in console)
For this you can choose use Win key, its useless in Linux anyway, so you might as well find some use for it.
The console solution:
xmodmap -e "keycode 13 = 4 EuroSign 4 EuroSign"
xmodmap -e "keycode 13 = 4 dollar 4 dollar"
xmodmap -pke > .xmodmap
xmodmap .xmodmap
Now if you want, for example, to change the
$
sign (which you can type it using Shift+4
shortcut when you have an US English keyboard) with €
sign, you can use the following command in terminal in terminal:From now you can type
€
using Shift+4
shortcut.To switch back to
$
sign, use:To get this change for every session, create a file called
.xmodmap
,
with the following command:Then, create a file called
.xinitrc
in your home
directory, containing the following line/command:In the same mode you can set any other key combination to type
€
symbol. Use xmodmap -pke
command to
see all keycodes and their map assignment.Monday, October 31, 2016
Presenting pdf with next slide and timer
Finding a tool that is not heavy weight in order to do presentations is not as easy as it seems.
But on Ubuntu pdf-presenter-console dies the job quite well.
Just provide a pdf.
The pdf can be easily generated by markdown using pandoc or your pdf generator of choice.
The project name is pdfpc and can be found on github
Saturday, October 29, 2016
An alternative to lens flare correction
That can help you sort out the flare without an issue.
Lens flare correction with gimp
It can be corrected with gimp. Check out this article. I am copying the text here so it wont dissappear if the post goes away.
After purchasing a glorious new Nikon D40X Digital SLR Camera online today, I was inspired to fix up a couple images.
So, I was trying to get rid of the obvious flaw in the following picture, and I found a pretty easy way to do it with GIMP.Now, I’m no expert at GIMP or anything, but all I did was select the region in question using the lasso, like so:Then, I used the Colors -> Components -> Channel Mixer tool to bend it to my will (make sure you grow your selection to encompass the whole flare using the Select -> Grow tool):Notice how in the preview window the blemish isn’t visible? That’s what you want. Now, hit OK.So, now all we have is a little bit of a color/contrast issue. Let’s fix that up with the Colors -> Color Balance tool:Now, if you look closely, you can still see just a tiny bit of brightness, but that’s alright with me – it’s much better than the blue crap. Here’s the end result:And there you have it: how to remove those annoying lens flares with GIMP.
Sunday, October 16, 2016
Thursday, October 6, 2016
Getting webex to run on linux
Get this image
url: https://hub.docker.com/r/dnk8n/docker-webex/
command: docker pull dnk8n/docker-webex
close all running firefox instances
start image
sudo docker run -it \
--env DISPLAY=unix$DISPLAY \
--privileged \
--name=docker-webex \
--volume /dev/snd:/dev/snd \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
dnk8n/docker-webex:latest $1
if firefox is already open and you want to maintain your existing session
sudo docker run -it \
--env DISPLAY=unix$DISPLAY \
--privileged \
--name=docker-webex \
--volume /dev/snd:/dev/snd \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
dnk8n/docker-webex:latest $1 \
/usr/bin/firefox go.webex.com --no-remote
make sure there is no whitespace after \ otherwise the multiline commands wont work
Wednesday, October 5, 2016
The last unicorn, by Peter S Beagle
A nice book with a rather poetic style and multiple references to the power of the stories.
Recommended
Finetuning an adafruit pir sensor
These sensors are a bit tricky to calibrate, so this web site is quite handy http://arduinobasics.blogspot.co.uk/2013/12/pir-sensor-part-2.html
Saturday, September 3, 2016
Weaverley by sir Walter Scott
It is one of the classic books of Scottish literature and narrates the story of an English gentleman of the name Weaverley, that serves as an officer in the English army during the Jacobite civil war.
Apart from the very long editorial, which may or may not exist in different versions of the book, and the somewhat flowery style of sir Scott, the book is captivating. It is describing the social structure in the scottish highlands during the civil war and also describes how the war itself affected the future generations of Scotland.
Overall a very interesting reading to anyone who is interested in understanding the complicated history of Scotland.
Wednesday, August 10, 2016
Resizing disk space in Virtualbox virtual machine
First you need to convert your disk to vdi by cloning.
Vdi can be resized and replace the vmdk disk in place. Just remove the vmdk in the settings
Internal partition needs to be resized this can be done by using the gparted iso:
http://gparted.sourceforge.net/download.php
Add the gparted as a cd iso and boot from it, resize the partition. In the next boot the system will recognize the new capacity
Vdi cloning and disk increase can be done with the following two commands:
- VBoxManage clonehd "/home/nickapos/VirtualBox VMs/NCRWin7/NCRWin7-2016-06-27-disk1.vmdk" "/home/nickapos/VirtualBox VMs/NCRWin7/win7clone.vdi" --format vdi
- VBoxManage modifyhd "/home/nickapos/VirtualBox VMs/NCRWin7/win7clone.vdi" --resize 100000
After that we are ready to boot. This will work with windows as well as linux. If you need to export your vm, there is a chance that Virtualbox will convert the image back to vmdk
Monday, August 1, 2016
Ubuntu ufw and docker
That means that it will open ports that you never intended to open to the world.
In order to disable this, you need to add the --iptables=false in its arguments and restart it.
Saturday, July 30, 2016
Haskell in Docker
If you want to try haskell, or try a different version of haskell than the one you have on your system, you can use one of the official haskell docker containers.
All you need is Docker and the following two commands:
docker pull haskell
docker run --rm --interactive --tty haskell
and you are done, you are in ghc interactive mode
Thursday, July 28, 2016
Merging git branches while keeping some files from the old branch
Master has evolved and we would like to merge its changes in the experimental branch, that has not yet lost its value.
But there are some files in the experimental branch we would like to keep.
How can we do that?
First we need to create our own merge driver. A merge driver is the command that is responsible for the actual merging of the files. In this case we need a driver that does not do anything to the files we want to preserve.
We can accomplish that by using this command:
git config --global merge.ours.driver true
This driver will always return true for every file that meets a specific pattern. What is this pattern and how do we configure it?
We need to create a file called .gitattributes in our project, version it, and add as contents the pattern of the files we would like to keep from being merged:
echo 'email.json merge=ours' >> .gitattributes git add .gitattributes git commit -m 'chore: Preserve email.json during merges'
This will protect a file called email.json from being merged.
After that we execute
git merge -
If you need more details please check this link: https://medium.com/@porteneuve/how-to-make-git-preserve-specific-files-while-merging-18c92343826b#.fbw1wyyby
Wednesday, July 27, 2016
Inspecting a docker container.
But what happens when you want to actually finetune its deployment? What happens when you want to find out if there are multiple ports or volumes defined, in it. What are the hashes that are being used in your system?
All these can be retrieved by using the docker inspect command:
docker inspect grafana
And this is the output:
[
{
"Id": "6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579",
"Created": "2016-07-27T17:32:56.328619446Z",
"Path": "/run.sh",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 8153,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-07-27T17:32:57.239316798Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:932c5bca836b177b4f2071fd1061d8649f74fb510fe51b5e2d466a0e4856f10a",
"ResolvConfPath": "/zfspool1/docker/containers/6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579/resolv.conf",
"HostnamePath": "/zfspool1/docker/containers/6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579/hostname",
"HostsPath": "/zfspool1/docker/containers/6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579/hosts",
"LogPath": "/zfspool1/docker/containers/6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579/6280c5bb41b8a5410d0d35b478e1617d77c332df503b32271cebdc5aadc68579-json.log",
"Name": "/grafana",
"RestartCount": 0,
"Driver": "aufs",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"3000/tcp": [
{
"HostIp": "",
"HostPort": "3000"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": [
"grafana-storage"
],
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"StorageOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"BlkioIOps": 0,
"BlkioBps": 0,
"SandboxSize": 0
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Name": "b68a5fe8f6e8c817bfacbbd8004e2452411673bd631e09564873a58badc0ac3d",
"Source": "/zfspool1/docker/volumes/b68a5fe8f6e8c817bfacbbd8004e2452411673bd631e09564873a58badc0ac3d/_data",
"Destination": "/etc/grafana",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
},
{
"Source": "/zfspool1/grafana-volume",
"Destination": "/var/lib/grafana",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Name": "ac220948e55e4e65ac9905b480bf1150aa8732a0ab6b094a8269032921478775",
"Source": "/zfspool1/docker/volumes/ac220948e55e4e65ac9905b480bf1150aa8732a0ab6b094a8269032921478775/_data",
"Destination": "/var/lib/grafana/plugins",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
},
{
"Name": "7be07c6927bbe12d0957a05a8bf3284a6e10c0ec9152646b85c2583e47a2ac6e",
"Source": "/zfspool1/docker/volumes/7be07c6927bbe12d0957a05a8bf3284a6e10c0ec9152646b85c2583e47a2ac6e/_data",
"Destination": "/var/log/grafana",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "6280c5bb41b8",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3000/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "grafana/grafana",
"Volumes": {
"/etc/grafana": {},
"/var/lib/grafana": {},
"/var/lib/grafana/plugins": {},
"/var/log/grafana": {}
},
"WorkingDir": "",
"Entrypoint": [
"/run.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "121cb533502a3613ed086db64b3291c6dcaf2808fa97499c5bd1aac95a913593",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3000"
}
]
},
"SandboxKey": "/var/run/docker/netns/121cb533502a",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "bd06a65e45743a62d86509ff4ec49b38f78e8c23c5dc45c74c3cdfb98c840c21",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "8312143de9ee482776c4b923b71d695687244fc9ac28ec8d151bd7678a9240ae",
"EndpointID": "bd06a65e45743a62d86509ff4ec49b38f78e8c23c5dc45c74c3cdfb98c840c21",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
}
]
Sunday, July 24, 2016
Setting up a freebsd box with Vagrant
Saturday, July 23, 2016
Installing latex packages with greek support for ubuntu 16.04
So in order to compile my latex files with Greek support and all, i need to install the following packages (and their dependencies) in ubuntu 16.04:
- texlive
- texlive-latex-extra
- texlive-lang-greek
Tuesday, July 12, 2016
Autojump usage
It does all that by keeping statistics of which folders we visit most frequently and by making that available to us through some handy shortcuts.
There are multiple integrations with various shells, and an autojump plugin bundled with my oh-my-zsh.
Installation:
We can install autojump using our package manager:
sudo apt-get install autojump
After that we need to source its initialization file. There are different files for each mainstream shell, so for zsh in ubuntu this line should do the trick:
[[ -s /usr/share/autojump/autojump.zsh ]] && . /usr/share/autojump/autojump.zsh
copy that in your .zshrc and do a
. ~/.zshrc
you are ready to use autojump now.
Usage:
See statistics:
autojump -s
Navigate:
j dir
Open a directory in file browser instead of navigating:
jo dir
Autojump website:https://github.com/wting/autojump
Autojump usage
It does all that by keeping statistics of which folders we visit most frequently and by making that available to us through some handy shortcuts.
There are multiple integrations with various shells, and an autojump plugin bundled with my oh-my-zsh.
Installation:
We can install autojump using our package manager:
sudo apt-get install autojump
After that we need to source its initialization file. There are different files for each mainstream shell, so for zsh in ubuntu this line should do the trick:
[[ -s /usr/share/autojump/autojump.zsh ]] && . /usr/share/autojump/autojump.zsh
copy that in your .zshrc and do a
. ~/.zshrc
you are ready to use autojump now.
Usage:
See statistics:
autojump -s
Navigate:
j dir
Open a directory in file browser instead of navigating:
jo dir
Autojump website:https://github.com/wting/autojump
Thursday, July 7, 2016
Cleaning up docker device mapper
During everyday operation lots of images are downloaded that are never deleted , so the device mapper may end up taking a lot of space in your system, unless you remember to clean it up regularly.
You can see the details about your docker instance by executing
sudo docker info
This command will tell you what backend you are using and how much space is allocated to it.
After executing a container, you may want to clean up the images it downloaded in order for it to run. People usually forget to do this and eventually they end up taking a lot of space.
An easy way to clean any unused images and cleanup your device mapper is by executing the following command:
sudo docker images -a|awk '{print $3}'|xargs sudo docker rmi
In the past there was a bug that prevented docker from releasing the disk space. This has been now resolved and you should have no issues if you are running a newer kernel than 3.13
Monday, June 27, 2016
An alternative to dynamic dns using consul
What happens if your dynamic DNS suddenly stops working?
There is an alternative, provided you have access to a consul server.
You can set up your system to push its IP to the consul server (either the service backend, or the Key/Value store).
The following example is using the KV store
You can use the following commands in your remote system:
First of all you need to retrieve your external IP:
EXTERNAL_IP=$(curl "http://myexternalip.com/raw")
and then you need to push it to your consul server
curl -X PUT -d "$EXTERNAL_IP" http://consul-server/v1/kv/keyname/externalIP
You can set up this to be executed every now and then in order to update the key every time it changes by your provider.
these data can then be consumed by another script from any other system that need access to your remote system:
curl -s http://consul-server/v1/kv/keyname/externalIP|grep -Po '"Value":.*?[^\\]",'|awk -F: '{print $2}'|tr -d '",'|base64 -d|tr -d '%'
to retrieve the IP of the remote system.
You can then use this either directly, or put it in /etc/hosts or any other system you like.
Just keep in mind that you also need to execute this often since your ISP will change the remote IP relatively often (e.g a couple times per day)
Wednesday, May 25, 2016
Http proxying through an ssl tunnel
And an ssl tunnel to that system that effectively maps a local port (e.g 8080) to the remote one.
Assuming the proxy on the other side is up and running, we can do the following:
ssh -L 8080:localhost:8888 remote-server-with-proxy-service
Now we can configure one of our local browsers to use local port 8080 and access the proxy on the other side.
A useful trick if we need to access services geographically restricted (e.g tv streaming etc)
Sunday, May 22, 2016
Haskell in production
Interested in haskell in production? Take a look at this http://www.stephendiehl.com/posts/production.html
Saturday, May 14, 2016
LiquidCrystal Displays compatible with the Hitachi HD44780 driver and arduino pin mapping
The full details about the various pins can be found here.
There is an arduino shield that can be used for fast prototyping with a weird (at least for me) pin mapping. The pin mapping the shield is using is: lcd(8, 9, 4, 5, 6, 7).
However if you buy a naked lcd, you can wire it up any way you like. Unfortunately if you are using the shield to develop your app and have a different pin mapping in your naked lcd, that means that you need to modify the code between debugging and normal mode, or wire your lcd in the same way with the shield.
Most code examples out there are using the shield mapping as well.
Anyway. The lcd has 16 pins. Some of them can be wired only one way:
- VSS (pin 1) -> Ground
- VDD (pin 2) -> 5Volt
- V0 (pin 3) -> 10K resistor/pot (this pin controls the contrast)
- R/W (pin 5) -> Ground
- A (pin15) -> 10K resistor/pot (this pin controls the backlight)
- K (pin 16) -> Ground
and there are another 6 data pins that can be wired any way we like. The shield mapping is the following:
- RS (pin 4) -> Digital pin 8
- E (pin 6) -> Digital pin 9
- D4 (pin11) -> Digital pin 4
- D5 (pin12) -> Digital pin 5
- D6 (pin13) -> Digital pin 6
- D7 (pin14) -> Digital pin 7
This mapping should allow you to have the same mapping between your development environment and your final setup.
Friday, May 13, 2016
Cleaning hazy photos
Using gimp, multiple passes of the unsharpen mask filter with a radius of 50 and an amount of 0.2 will usually do the trick. After a certain point noise is introduced, so caution is needed.
The documentation for the filter can be found here https://docs.gimp.org/en/plug-in-unsharp-mask.html
Saturday, May 7, 2016
Verifying https key and certificate match
In these cases you can use the following commands:
openssl x509 -noout -modulus -in /etc/yourcertificate.crt | openssl md5
openssl rsa -noout -modulus -in /etc/private.key | openssl md5
Also keep in mind that the CN name of the certificate sign request (CSR) needs to match the CN of the certificate.
If you have more than one domain entries in the certificate, the first one is the CN. Multiple https virtualhost definitions (including the default ssl.conf) may confuse apache.
Wednesday, April 27, 2016
Tuesday, April 26, 2016
Holy Island: A DCI Ryan Mystery by LJ Ross
This book was a best seller when it was released in 2015. It is a detective novel, with pagan cult highlights. Not too deep, but a good and easy read nevertheless.
Thursday, April 21, 2016
Using bus pirate to communicate with chips
Check this post http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/
The bus pirate can be connected to a Linux box using a terminal emulator or multiplexer (screen and tmux should work fine)
It can also be used as a logic analyser using an opensource java based tool
https://www.lxtreme.nl/ols/
Another article with usage instruction https://learn.sparkfun.com/tutorials/bus-pirate-v36a-hookup-guide
Wednesday, April 20, 2016
Dynamic dns update with new server
I will include the content of the article here for archival purposes:
In a previous post quite sometime back we explained how to configure a DynDNS service on your Raspberry pi or any similar unix system. This is no different, except for the super easy way of doing the similar thing.
Here we would be using the free DynDNS service of dns4e.com
Step. 1
Goto to https://dns4e.com/registration and sign up
Step. 2
Verify the registered email to activate the service
Step. 3
Add a zone in your account (e.g.: techjawab.dns4e.net)
You can add your own host (which you might have bought separately), in that case you will also need to update the name-servers after this step.
Step. 4
Setup a cron job to update your dynamic ip to dns4e
sudo crontab -e
In the editor add the following line on a new line to update your DNS every 10 minutes
*/10 * * * * curl 'https://api.dns4e.com/v7/<zone address
That's all, you should be able to reach out to your hosted server via the zone address you just configured after the DNS propagates.
Note: If your raspberry pi or unix box is behind a router or firewall then you might have to do port forwarding accordingly to enable the outside world to reach your server.
Tuesday, April 19, 2016
High current usb charging devices
It seems that in order for some devices to detect a charger as high current, the data pins need to be short circuited. This will not work with Apple devices so a data voltage mapping need to be done in that case.
Thursday, April 14, 2016
Dirk Pitt 6, A night probe
As the series progress, they get better. This one is a spy storie. Multiple storylines, and a few unbelievable twists, but enjoyable.
Monday, April 11, 2016
Λεονάρντο ντα βιντσι δια την ζωγραφιά
Νομίζω ότι αυτό είναι ένα από τα πιο ενδιαφέροντα βιβλία που έχω δει τον τελευταίο καιρό : http://www.presspublica.gr/παναγιώτης-ιωάννου-διά-την-ζωγραφ/
Resizing disks in vms
I am going to copy and paste the content, just in case it disappears in the future.
VirtualBox : Extend Virtual Disk and File System
- Extend Virtual Disk
- Create Virtual Disk
- Partition the New Space
- Add Partition to LVM
- Resize Fixed Size Disks
Extend Virtual Disk
VBoxManage modifyhd
command. The approach is similar on Linux and Windows. The --resize
option assumes a size is specified in megabytes. If you want to specify the size in bytes, use the --resizebytes
option.$ cd /u01/VirtualBox/ol6-112/ $ VBoxManage modifyhd ol6-112.vdi --resize 40960 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% $ C:\>cd "C:\Users\myuser\VirtualBox VMs\ol6-112" C:\Users\myuser\VirtualBox VMs>"C:\Program Files\Oracle\VirtualBox\VBoxManage" modifyhd ol6-112.vdi --resize 40960 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% C:\Users\myuser\VirtualBox VMs>
$ VBoxManage modifyhd ./ol6-112.vdi --resize 40960 VBoxManage: error: Cannot register the hard disk '/u01/VirtualBox/ol6-112/ol6-112.vdi' {fc63137b-c779-41a2-b0a3-5fb5788e77cc} because a hard disk '/u01/VirtualBox/ol6-112/ol6-112.vdi' with UUID {fc63137b-c779-41a2-b0a3-5fb5788e77cc} already exists VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp $ $ VBoxManage modifyhd fc63137b-c779-41a2-b0a3-5fb5788e77cc --resize 40960 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% $
Create Virtual Disk
$ cd /u01/VirtualBox/ol6-112/ $ VBoxManage createhd --filename ol6-112b.vdi --resize --size 10240 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Disk image created. UUID: 34d7532e-cd4c-4bf8-88e3-5207aca1e343 $ VBoxManage storageattach ol6-112 --storagectl "SATA" --port 1 --device 0 \ --type hdd --medium ol6-112b.vdi --mtype normal $ C:\>cd "C:\Users\myuser\VirtualBox VMs\ol6-112" C:\Users\myuser\VirtualBox VMs>"C:\Program Files\Oracle\VirtualBox\VBoxManage" createhd ^ --filename ol6-112b.vdi --size 10240 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Disk image created. UUID: 532fa35b-a437-4a07-8f4a-5503e9049cb6 C:\Users\myuser\VirtualBox VMs>"C:\Program Files\Oracle\VirtualBox\VBoxManage" storageattach ol6-112 ^ --storagectl "SATA" --port 1 --device 0 ^ --type hdd --medium ol6-112b.vdi --mtype normal C:\Users\myuser\VirtualBox VMs>
# ls /sys/class/scsi_host/ host0 host1 host2 # # echo "- - -" > /sys/class/scsi_host/host0/scan # echo "- - -" > /sys/class/scsi_host/host1/scan # echo "- - -" > /sys/class/scsi_host/host2/scan
# ls /sys/class/scsi_device 1:0:0:0 2:0:0:0 # # echo 1 > /sys/class/scsi_device/1:0:0:0/device/rescan # echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan
Partition the New Space
# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_ol6112-lv_root 26G 19G 5.3G 78% / tmpfs 1004M 88K 1004M 1% /dev/shm /dev/sda1 485M 144M 316M 32% /boot //192.168.0.4/u02 907G 746G 115G 87% /host #
# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00076f69 Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 3917 30944256 8e Linux LVM Command (m for help):
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (3917-5221, default 3917): Using default value 3917 Last cylinder, +cylinders or +size{K,M,G} (3917-5221, default 5221): Using default value 5221 Command (m for help):
Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM) Command (m for help):
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. #
Add Partition to LVM
pvcreate
command.# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created #
vgdisplay
command, then use the volume group name and partition name with thevgextend
command.# vgdisplay --- Volume group --- VG Name vg_ol6112 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 29.51 GiB PE Size 4.00 MiB Total PE 7554 Alloc PE / Size 7554 / 29.51 GiB Free PE / Size 0 / 0 VG UUID M3LcFJ-etHj-u7zh-I4em-4Js0-SczK-8JDj93 # vgextend vg_ol6112 /dev/sda3 Volume group "vg_ol6112" successfully extended #
lvdisplay
command to get the root logical volume name. Use the vgdisplay
command to get the free space in the volume group. Use this information in the lvextend
command to extend the logical volume.# lvdisplay | grep "LV Path" LV Path /dev/vg_ol6112/lv_root LV Path /dev/vg_ol6112/lv_swap # vgdisplay vg_ol6112 | grep Free Free PE / Size 2558 / 9.99 GiB # lvextend --size +9.99G --resizefs /dev/vg_ol6112/lv_root Rounding size to boundary between physical extents: 9.99 GiB Extending logical volume lv_root to 35.56 GiB Logical volume lv_root successfully resized resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_ol6112-lv_root is mounted on /; on-line resizing required old desc_blocks = 2, new_desc_blocks = 3 Performing an on-line resize of /dev/mapper/vg_ol6112-lv_root to 9322496 (4k) blocks. The filesystem on /dev/mapper/vg_ol6112-lv_root is now 9322496 blocks long. #
# lvextend --extents +2559 --resizefs /dev/vg_ol6112/lv_root
lvextend
command used the --resizefs
option. If we had not used this, we would have to run the resize2fs
command separately.# resize2fs /dev/vg_ol6112/lv_root
# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_ol6112-lv_root 36G 19G 15G 56% / tmpfs 1004M 88K 1004M 1% /dev/shm /dev/sda1 485M 144M 316M 32% /boot //192.168.0.4/u02 907G 746G 115G 87% /host #
Resize Fixed Size Disks
VBoxManage modifyhd
command doesn't work on fixed disks, so to get around this, simply clone the existing disk to a dynamically allocated disk, then resize that.$ VBoxManage clonehd ol6-112.vdi ol6-112-b.vdi --format VDI --variant Standard $ VBoxManage modifyhd ol6-112-b.vdi --resize 40960
Friday, April 8, 2016
Dirk Pitt 5: Vixen 03
This book is better than the others, it has multiple storylines, and even though the end is predictable, the plot is actually not.
Sunday, April 3, 2016
Numa 4 white death
Another adventure book with Austin Kurt investigating a company of fish farming. Quite light and enjoyable.
Wednesday, March 30, 2016
A time to kill, by John Grisham
Finished this book, that is about the trial of a black father who killed the rapists of his daughter. I must admit that I do not usually read books from this genre, but I liked it a lot.
The legal technicalities were from time to time a bit boring, but overall this is one of the best books I have read in the past few months
Thursday, March 24, 2016
Dirk Pitt 3: Ice Fire
A Dirk Pitt book without Dirk Pitt, still uncomplicated but better on the action side than the first two. An attempt has been made to explain the basic idea in a scientific way. Still enjoyable reading
Thursday, March 17, 2016
How to change hostname in centos7
- hostnamectl command : Control the system hostname. This is recommended method.
- nmtui command : Control the system hostname using text user interface (TUI).
- nmcli command : Control the system hostname using CLI part of NetworkManager.
Wednesday, March 16, 2016
Dirk Pitt 2: the Mediterranean caper
The second book of the series. Another James bond like book, simple but enjoyable. The hero always gets the girl
Tuesday, March 15, 2016
Tuesday, March 8, 2016
Dirk Pitt book 1
Light, enjoyable reading. The kind that would be ideal for a James bond like film. The plot is a bit naive and the characters rather shallow. Good for relaxation after work
Wednesday, March 2, 2016
Casual vacancy
This is an adult book from John K Rowling. The story revolves around a small town called Pagford and a larger city next to it called Yarvil. It is an interesting story albeit a little dramatic.
Sunday, January 31, 2016
Regulating automatic watches using audacity
Nice blog post http://beomagi.blogspot.co.uk/2015/03/regulating-mechanical-watch-cheaply.html
Sunday, January 10, 2016
Replacing watch movement
Never thought about replacing the movement of an old watch but it seems it is possible http://blog.esslinger.com/how-to-replace-a-watch-movement/