2019年2月25日 星期一
Linux dd command usages
dd 指令教學與實用範例,備份與回復資料的小工具
Refer to: https://blog.gtwang.org/linux/dd-command-examples/
備份整顆硬碟
將 /dev/sda 所有的資料寫入 /dev/sdb:
sudo dd if=/dev/sda of=/dev/sdb conv=noerror,sync
建立硬碟的備份影像檔
sudo dd if=/dev/hda of=~/hdadisk.img
從備份影像檔回復硬碟資料
sudo dd if=hdadisk.img of=/dev/hdb
備份磁碟分割區
sudo dd if=/dev/hda1 of=~/partition1.img
兩個磁碟分割區對拷:
sudo dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=noerror,sync
備份 CD/DVD 光碟
sudo dd if=/dev/cdrom of=tgsservice.iso bs=2048
備份 CD/DVD 光碟, 壓縮資料
sudo dd if=/dev/sda | gzip > sdadisk.img.gz
從壓縮過的影像檔回復資料
sudo gzip -dc sdadisk.img.gz | dd of=/dev/sda
Linux 使用 dd 指令將 ISO 檔製作成 Live USB 隨身碟
Refer to: https://blog.gtwang.org/linux/linux-dd-command-write-iso-to-usb-flash-drive/
umount /media/pi/disk
卸載後再次確認一下卸載的 USB 隨身碟是否正確:
lsblk
用 dd 指令將 Linux 的 ISO 映像檔寫入 USB 隨身碟
sudo dd if=ubuntu-16.10-desktop-amd64.iso of=/dev/sdc bs=1M
2018年12月7日 星期五
How to backup and restore (WSL) Windows Subsystem for Linux?
Backup WSL (Windows Subsystem for Linux)
Example: backup_wsl.sh
Restore WSL using lxrunoffline
Refer to:
1. https://superuser.com/questions/1164818/how-to-backup-wsl-linux-subsystem-for-windows-10-before-system-reset-or-reins
Example: backup_wsl.sh
#! /bin/bash cd / tar vzcpf /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.tar.gz \ --exclude=/proc --exclude=/dev --exclude=/mnt --exclude=/media \ --exclude=/lost+found --exclude=/tmp --exclude=/sys --exclude=/run / \ > /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.log \ 2> /mnt/i/tmp/ubuntu_`date +%Y%m%d_%H`.error
# lxrunoffline run -n <distro name> -w C:\wsl> lxrunoffline run -n mybackup -w
Refer to:
1. https://superuser.com/questions/1164818/how-to-backup-wsl-linux-subsystem-for-windows-10-before-system-reset-or-reins
2018年12月6日 星期四
Enable VT-x on Win10 by command line
1. Run cmd with administrator
2. Run bcdedit /set hypervisorlaunchtype on
3. Reboot
2. Run bcdedit /set hypervisorlaunchtype on
3. Reboot
2018年8月20日 星期一
Create git repo
Server:
1. sudo rm -rf xxx_sdk
2. sudo git init --bare xxx_sdk
3. sudo chmod 775 -R xxx_sdk
4. sudo chown root:gitgrp -R xxx_sdk
Client:
1. git clone name@192.168.0.124:/home/repos/git/proj/xxx_sdk xxx_sdk
2. git add file
3. git commit -a
4. git push origin master:master
2018年7月2日 星期一
ADB device not found on VirtualBox and VMware
1. Try to replace your USB cable
2. Check VirtualBox's or VMware's USB devices
3. Use physical UNIX / Linux / CentOS or Ubuntu, don't use VirtualBox and VMware
4. Use DOS mode ADB
2. Check VirtualBox's or VMware's USB devices
3. Use physical UNIX / Linux / CentOS or Ubuntu, don't use VirtualBox and VMware
4. Use DOS mode ADB
2018年3月22日 星期四
VMware CPU usage is high when I start adb on ubuntu guest
Message from https://communities.vmware.com/thread/505263?start=15&tstart=0
HoboJ Aug 27, 2015 8:38 PM
I'd like to confirm that this issue exists too. I have Workstation PRO 12 installed on Windows 10, running a Ubuntu 14.04.03 VM. After booting the VM the host machine will show 0% CPU utilization in task manager (for VMware Workstation (32bit)), but if I execute "adb devices" (which also starts the adb server) in the VM the CPU utilization on the host machine starts to slowly increase and after some time the VM becomes unusable. However, if I execute "adb kill-server" before the VM fully hangs, the host CPU utilization drops back to 0%. Note that the high CPU utilization is seen on the host machine, not on the VM after running the "adb devices" command.
Explanation from VMware: (This issue was solved in VMware Workstation 12 Pro Version 12.1.1)
Starting an ADB daemon in an Ubuntu or Debian guest operating system causes a memory leak, which in turn causes the VMware Workstation window to become less responsive over time.
Refer to:
1. https://communities.vmware.com/thread/505263
2. https://communities.vmware.com/thread/505263?start=15&tstart=0
3. https://docs.vmware.com/en/VMware-Workstation-Pro/12.0/rn/workstation-1211-release-notes.html
HoboJ Aug 27, 2015 8:38 PM
I'd like to confirm that this issue exists too. I have Workstation PRO 12 installed on Windows 10, running a Ubuntu 14.04.03 VM. After booting the VM the host machine will show 0% CPU utilization in task manager (for VMware Workstation (32bit)), but if I execute "adb devices" (which also starts the adb server) in the VM the CPU utilization on the host machine starts to slowly increase and after some time the VM becomes unusable. However, if I execute "adb kill-server" before the VM fully hangs, the host CPU utilization drops back to 0%. Note that the high CPU utilization is seen on the host machine, not on the VM after running the "adb devices" command.
Explanation from VMware: (This issue was solved in VMware Workstation 12 Pro Version 12.1.1)
Starting an ADB daemon in an Ubuntu or Debian guest operating system causes a memory leak, which in turn causes the VMware Workstation window to become less responsive over time.
Refer to:
1. https://communities.vmware.com/thread/505263
2. https://communities.vmware.com/thread/505263?start=15&tstart=0
3. https://docs.vmware.com/en/VMware-Workstation-Pro/12.0/rn/workstation-1211-release-notes.html
2018年3月21日 星期三
How can I connect to Android with ADB over TCPIP?
1. Activate debug mode in Android
5. Disconnect USB
6. Now your adb connection is over TCPIP
7. Return adb over USB
8. Now your adb connection is over USB
Refer to:
https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp
2. Connect to pc via USB
3. Get Android Devices' IP address
4. Open Terminal and type ...
adb tcpip 5555
adb connect <device IP>:5555
6. Now your adb connection is over TCPIP
7. Return adb over USB
adb usb
Refer to:
https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp
Bridge wifi to VMware Guest OS
1. Edit / Virtual Network Editor
2. Edit / Virtual Network Editor / Change Setting
3. Select VMnet0 and Click Automatic Setting, Deselect all of Wi-Fi
4. Add Network -- VMnet2 and bind to Wifi
5. Added Network Adapter 2 and bind to VMnet2
Refer to:
1. https://www.vmware.com/support/ws55/doc/ws_net_configurations_changing_bridged_windows.html
2018年1月1日 星期一
Raspberry Pi install chinese input and font
1. Config locale
sudo raspi-config
3. Select "Change Locale"
4. Select "en_US.UTF-8" & "zh_TW.UTF-8", and Press "OK"
5. Select "en_US.UTF-8" or "zh_TW.UTF-8" for console
6. Install 酷音中文輸入法
sudo apt-get install scim-chewing
sudo apt-get install ttf-wgy-microhei ttf-wgy-zenhei xfonts-wgy
Refer to:
https://blog.gtwang.org/iot/raspberry-pi-chinese-input-method/
Installing Raspberry Pi Image
1. Format SD card to FAT32
2. Download NOOBS from https://www.raspberrypi.org/downloads/
3. Unzipped NOOBS and copy all files to SD root directory
4. Boot Raspberry Pi with SD card
5. Select Raspbian image to install in SD card
2. Download NOOBS from https://www.raspberrypi.org/downloads/
3. Unzipped NOOBS and copy all files to SD root directory
4. Boot Raspberry Pi with SD card
5. Select Raspbian image to install in SD card
訂閱:
文章 (Atom)