카테고리 보관물: Tools & Tips

Virtual Box에 ext4 partition을 직접 mount

Windows용 Virtual Box에서 vdi file이 아닌 HDD의 특정한 영역을 ext4로 직접 mount하는 방법에 대한 설명이다. 오래전에 해본거라 실제로 속도 향상이 있었는지는 기억이 나지 않는다..

HDD를 format하지 않으면 windows의 탐색기에서는 표시되지 않지만 Disk Manager에서는 연결된 모든 HDD가 보인다. Virtual Box를 설치한 directory에 보면 vboxmanage.exe라는 실행 파일이 있는데 이것을 이용하면, vdmk file을 생성하고 물리적인 HDD를 virtual box에 mapping할 수 있다.

vboxmanage.exe은 VirtualBox 4.2.10 현재 admin 권한이 있는 CLI로만 동작하기 때문에, Admin 권한으로 명령창을 열고 Virtual Box의 설치 경로로 가서 vboxmanage.exe를 실행시킨다.

c:\Program Files\Oracle\VirtualBox> vboxmanage internalcommands createrawvmdk -filename "C:\Users\<USER>\VirtualBox VMs\vmdks\extdata1.vmdk" -rawdisk \\.\PhysicalDrive1

-rawdisk의 parameter인 ‘PhysicalDrive’뒤의 숫자는 windows Disk Manager에 나오는 Disk 0, Disk 1 …에 나오는 숫자와 일치한다.

이제 Virtual Box에서 설정을 열고 storage에 지금 생성한 vmdk file을 추가한다.

Add the vmdk from Settings -> Storage -> SATA

Booting을 하고 linux에서 fdisk -l 명령어로 확인해 보면 새로운 HDD가 인식된 것이 보인다. fdisk로 새로운 partition을 만들고 ext4 fs를 만든다음 fstab을 수정해서 linux에서 새로운 partition이 인식되도록 해주면 된다.

[Tip] Ubuntu 12.04 Eclipse tooltip 색상변경

Ubuntu(12.04)에서 eclipse를 설치하고 사용하다보면 tooltip이 어두운 배경색에 검은색 글씨로 되어 있어서 잘 안 보인다. 화면 밝기를 밝게하면 불가능 한 건 아니지만, class member를 쉽게 보여주기는 context menu를 실눈 뜨고 한 참 동안 쳐다보는게 여간 불편한게 아니다. 분명 internet 어딘가에는 나와 같은 불편을 겪는 사람이 있을텐데라고 생각하면서도 어떤 keyword로 검색해야 하는지 몰라서 여러 번 실패하고 나서야 드디어 찾았다.

How to change tooltip background color in Unity?

최근에 추가된 몇 개의 solution들은 시험해 보지는 못했으나, 아래의 script는 효과가 있었다.

#/bin/sh
# Tooltip fix
# A script to fix themes files in Ubuntu 11.10
#  to have readable tooltips in applications such
#  as eclipse.
# The script edits the gtk.css, settings.ini and gtkrc files
# Author: Victor Pillac
# http://victorpillac.wordpress.com

#if [ $EUID -ne 0 ]; then
#  echo "This script must be run as root" 1>&2
#  exit 1
#fi  

path=/usr/share/themes
theme=Ambiance

if [ $# = 1 ]; then
  theme=$1
fi

echo "Fixing tooltips for theme $theme"
echo " (you can select a different theme by passing its name as argument)"
sed -i 's/tooltip_bg_color #000000/tooltip_bg_color #f5f5b5/g' $path/$theme/gtk-3.0/gtk.css
sed -i 's/tooltip_fg_color #ffffff/tooltip_fg_color #000000/g' $path/$theme/gtk-3.0/gtk.css
sed -i 's/tooltip_bg_color:#000000/tooltip_bg_color:#f5f5b5/g' $path/$theme/gtk-3.0/settings.ini
sed -i 's/tooltip_fg_color:#ffffff/tooltip_fg_color:#000000/g' $path/$theme/gtk-3.0/settings.ini
sed -i 's/tooltip_bg_color:#000000/tooltip_bg_color:#f5f5b5/g' $path/$theme/gtk-2.0/gtkrc
sed -i 's/tooltip_fg_color:#ffffff/tooltip_fg_color:#000000/g' $path/$theme/gtk-2.0/gtkrc
echo "Done"

PlantUML war file 설치

그동안 UML을 그려야할 필요가 있을때 StarUML을 써왔는데, Windows만 지원하는 software라는 한계도 있고 해서 얼마 전 부터는 우연히 알게된 PlantUML을 사용하고 있다. 이 software는 마치 LaTex 처럼 text로 UML을 그리기 위한 description을 작성하면 이를 기반해서 UML을 그려준다. 문법도 그다지 어렵지 않고 직관적이어서 사용하기도 쉬운 편이다.

작성한 text를 UML로 그리기 위한 client program들은 여러가지 형태가 지원되는데 보다 자세한 목록은 여기에서  확인할 수 있다. 내가 그동안 사용하던 것은 Chrome extension이었는데 class diagram들이 조금씩 복잡해 지면서  여러개의 file로 쪼갤 필요가 있게 되니 ‘!include‘ directive를 사용할 수 없는 문제가 있었다. 아마도 Chrome이 보안 문제로 extension의 local file 간접 access하는 것을 막은게 아닐까 싶다. 그래서 servlet으로 설치하는 방법을 사용하기로 했다. 이전에 Opengrok을 설치한 적이 있으니 설치 환경은 ubuntu 12.04와 tomcat이 이미 설치된 상태 이다.

  • 필요한 package들의 설치
    : PlantUML servlet을 돌리려면 graphviz package가 필요한데 이것이 설치되어 있지 않으면 다음과 같은 오류가 발생한다. 그리고 war file을 쉽게 deploy하기 위해 tomcat-admin package를 설치했다.
    SC_plantuml_dot_file_not_exists_err
sudo apt-get install tomcat6-admin graphviz
  • PlantUML war file을 download 받기
    : PlantUML server release page에서 war file을 download 받는다.
  • Tomcat admin 설정
    : Tomcat admin으로 접속하려면 amdin 계정이 필요하니 만약 계정이 없다면 tomcat-users.xml file을 편집해서 계정을 추가해 준다. 이 파일에는 비밀번호를 평문으로 함께 기록해야 하기는 하지만, root와 tomcat외에는 read permission이 없으므로 다른 계정에 의해 이 파일이 읽히지는 않는다. 계정을 추가해준 이후에는 tomcat server를 재실행한다.

    sudo vi /var/lib/tomcat6/conf/tomcat-users.xml
 <!--
 NOTE: By default, no user is included in the "manager-gui" role required
 to operate the "/manager/html" web application. If you wish to use this a pp,
 you must define such a user - the username and password are arbitrary.
 -->
 <!--
 NOTE: The sample user and role entries below are wrapped in a comment
 and thus are ignored when reading this file. Do not forget to remove
 <!.. ..> that surrounds them.
 -->
 <role rolename="admin"/>
 <user username="admin" password="ADMIN_PASSWORD" roles="admin,manager,manager-gui"/>
 </tomcat-users>
  • Tomcat admin page로 부터 deploy: 모든 준비가 되었으니 tomcat admin page (http://SERVER:8080/manager/html) 에서 war file을 선택하고 deploy한다.
  • Service page 접속
    : Web browser에서 service page (http://SERVER:8080/plantuml)로 접속한다.