2015년 4월 30일 목요일

Essential Linux Commands (still updating)

gdm: How to stop & restart gdm

Go out from X by Ctrl+Alt+F1 and login to a console first and

$sudo service gdm stop
or
$sudo /etc/init.d/gdm stop

This works for most services in /etc/init.d/ with start/stop/restart.

blkid: How to get UUIDs of hard disks to tweak /etc/fstab

$sudo blkid
$sudo blkid -s UUID


hdparm: Find out Hard disk Spec (brand, model, size, etc.)

$sudo hdparm -I /dev/sda


Changing a target of symlink

instead of

$ rm -f symlink
$ ln -s target symlink

when a target is a file

$ ln -sf new_target symlink

not to mind the target is a directory or a file then

$ ln -sfn new_target_dir symlink


mdadm: Multiple Device Admin (Linux Software RAID)
$ cat /proc/mdstat
$ sudo mdadm /dev/md0 -r /dev/sda1
$ sudo mdadm /dev/md0 -a /dev/sda1


grub: Change the installed hard disk (MBR change, for example, into sda)

$ sudo grub-install /dev/sda
$ sudo update-grub

grub: Change the default boot kernel/OS

$ fgrep menuentry /boot/grub/grub.cfg
copy menuentry text that you want to boot by default,
$ sudo vi /etc/default/grub
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.2.0-16-generic"

(when your new kernel doesn't work properly && grub is already updated with the new kernel's entry, the text of GRUB_DEFAULT above works well)
$ sudo update-grub



2015년 4월 12일 일요일

Recovery of degraded arrays of RAID1 (레이드1에서 동기화 어긋난 하드 디스크 복구)

우분투 12 Saucy. RAID1으로 미러링 중인 두 하드 중 하나가 고장 나거나, 동기화가 어긋난 경우(degraded) 아래와 같이 해당 파티션을 제거 했다가 다시 추가하면 mdadm이 동기화를 다시 시켜서 복구함.

In Ubuntu 12 Saucy, with mirrored two hard drives, /dev/sda and /dev/sdb, which are partitioned as three volumes, 1, 2, and 3, sda's partitions are degraded by some unknown reason. This happens regularly to me around once every other year with two identical WD 500GB hard drives.

To sync the degraded array back, you simply detach (remove) the partition and attach (add) it again like the followings:

Remove the unsynced hard drive
$ sudo mdadm --remove /dev/md0 /dev/sda1
$ sudo mdadm --remove /dev/md1 /dev/sda2
$ sudo mdadm --remove /dev/md2 /dev/sda3

(You may not need to remove the hard drive, because if it has been long since it's degraded, mdadm removes the hard drive by itself.)

Add them again into the array (to run the sync process again)
$ sudo mdadm --add /dev/md0 /dev/sda1
$ sudo mdadm --add /dev/md1 /dev/sda2
$ sudo mdadm --add /dev/md2 /dev/sda3

Then mdadm synchronizes the partitions of the hard drive one by one with its mirrored one. It takes for a while up to the size of the hard drive.


우분투 12 Saucy. RAID1으로 미러링 중인 두 하드 중 하나가 고장 나거나, 동기화가 어긋난 경우(degraded) 위와 같이 해당 파티션을 제거 했다가 다시 추가하면 mdadm이 동기화를 다시 시켜서 복구함.


2015년 4월 6일 월요일

How to Make an Ejectable Internal Hard Disk Drive (SCSI device) Unejectable

My PC is built with Asrock Z68 Extreme4 gen3 which has a Marvell SATA3 (6G) chipset, and it has a problem that even though I disabled the SATA ports hot-swap in the BIOS, still it shows my internal hard drives in the tray as ejectable devices.

Checking/unchecking the 'Enable safely remove disk' option in the 'Policies' tab of Marvell SATA driver dialog from Device Manager also never worked.

Google and the respectful pre-path-walkers told me the followings:


1. How to Make an Ejectable Internal Hard Disk Drive Unejectable

Check out user12459's answer in the link above.

This no.1 solution works  greatly for the hard drives that are shown as a SATA drive, but it doesn't work for the ones which are shown as a SCSI device.

It's little annoying to create a batch file and the shortcut in the Startup folder, not a elegant way

2. How to Make an Ejectable Internal Hard Disk Drive which looks as a SCSI device in the tray Unejectable

Focus on the next line which appears in the linked page no.2 above.

reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_1000&DEV_0054&SUBSYS_197615AD&REV_01\4&1f16fef7&0&00A8" /v Capabilities /t REG_DWORD /d 2 /f

Making the code above as an .bat file and put create a shortcut of the file, and then cut and paste it in the folder that you can open with clicking 'Start' button -> All Programs ->  Startup', right-click on it and choose 'Open all users.'

However, you need to tweak some parts of the code above to make it work with your hard drive.

Run 'regedit.exe' and go to 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE\' and find the hard drive which your Windows system recognize as SCSI device.

In my case, it was 'DiskWDC_WD6400AAKS-00H2B0___________________07.04C07' (yes, WesternDigital 640GB HDD) and under it, there was '5&1599dfff&0&2.0.0' that seems like it is kinda ID of the hard drive.

You have to replace the bolded three parts, 'PCI', 'VEN_1000&DEV_...', '4&1f...'
 to your information is matched respectively, so with my computer,

  • 'PCI' to 'IDE'
  • 'VEN_1000&DEV_0054&SUBSYS_197615AD&REV_01' to 'DiskWDC_WD6400AAKS-00H2B0___________________07.04C07'
  • '4&1f16fef7&0&00A8' to '5&1599dfff&0&2.0.0'
Don't miss the backslash between three of those.

P.S. No.2 way is not perfect because Windows refreshes the list of removable devices at a boot time and also when some external device like a USB memory is connected or disconnected.

 
한글로 쓰려니... 일할 시간도 없고 너무 귀찮... 죄송합니다만 영어로 보세요.


'장치 안전하게 제거하기 내장 하드디스크' '트레이 내장 하드 장치 제거 안 보이게 하는 방법'

2015년 2월 10일 화요일

LG G Pro F240K (Korean Model) Unrooting and Software Update

LG 지 프로 KT, 언루팅 & 소프트웨어 업데이트

한글 요약: 루팅이 되었기에 OTA 소프트웨어 업데이트를 할 수 없던 젤리빈 LG G Pro(KT버전)를 아래 Way 3에 소개된 방법으로 킷캣으로 업그레이드 할 수 있었다.

Situation: Trying s/w update (4.4.2 Kitkat) on a rooted LG G Pro (F240K) of 4.1.2 Jellybean

Why: Abnormally slowed response recently and needs of unrooted phone

Problem: LG blocked s/w update on a rooted phone

Way 1.
Trying to unroot with keeping 4.1.2
Failed: Couldn't find the unrooting tool which is related to my previous rooting tool.

Way 2.
Using LG Mobile Support Tool
Failed: The program keeps saying the battery is low even though it's fully charged.

Way 3.
Using LG Flash Tool 2014 with the Jellybean KDZ file for F240K
Succeeded: Hurray!

Preparation: LG Mobile Support Tool (B2CAppSetup.exe), LG Flash Tool 2014 (.zip), KDZ file for F240K (.kdz)

  1. Run LGFlashTool2014.exe as an administrator
  2. Select Type: CDMA
  3. PhoneMode: EMERGENCY
  4. Select KDZ file
  5. Click [CSE Flash]
  6. Click [Start]
Then it will run LG Mobile Support Tool and start firmware update.

I don't know why, but in my case, it stopped at 4% and showed some instructions of rebooting the phone and there was a [Retry] button. Instead of following the sentences I just click the [Retry] button and it proceeded greatly up to 95%, and then the phone was rebooted.

The initial setting steps were begun with the greeting Droid image, but the proceeding bar was 95% still so I was waiting and finally it became 100% without any change on the phone screen. I unplugged the USB cable and checked the s/w version which was changed to Jellybean, of course not rooted.

After 6 times of trials of s/w update from Jellybean to Kitkat, the phone works finely awesome! It responses as a quad-core device. I had to select and install 78 apps manually from my previously installed app list of the Google Play Store but it was a chance for me to organize the unused apps, so no problem.

Big thanks to all xda devs and the uploaders of tools and kdz files. You're super!



Xubuntu: Installing a Printer (Canon G3060 PIXMA)

$ sudo apt install system-config-printer Download the proper driver for linux from Canon website. Turn on the printer and set up its WiFi. C...