顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2016年11月20日 星期日

Removing partitions (or format) of a USB

So… a while back I was playing around with Linux and needed a bootable install disc. I decided to make one of my spare USB thumb drives into one. All went well, and I successfully installed Ubuntu Server on my machine. Great.
Fast forward to this morning when I needed said thumb drive to transfer some pretty hefty files. Low and behold, my 4GB thumb drive was being read as a 2MB thumb drive. No problem… just format the thing, right? Uh… no. Apparently not.
To create the install disk, I used a nice little program called Image Writer for Windows It worked great, but unfortunately it partitioned my thumb drive, and Windows 7, for some reason, couldn’t get rid of the partitions when I tried to format it. Bleh. Thankfully, Google is always there when I need it.
It turns out there’s utility in Windows 7 (and probably other Windows versions as well, but I’m using 7) called Diskpart that will fix this problem right up for you. Here’s how to use it to format a USB drive.
  1. Bring up the command prompt. Easiest way is to go to the Start menu and type in “cmd” in the search box and hit enter.
  2. In the command prompt window, type “diskpart”. That will launch another window with a DISKPART> prompt.
  3. Type “list disk” to find out which disk your USB drive is. It should be pretty obvious from the size of the disk. If it’s not, alternatively, you can search “Computer Management” under the Start menu, and then click on “Disk Management”. You should see something that says “Disk 1 Removeable” or something similar.
  4. Once you know which disk you want, in the Diskpart window, type “select disk 1” (or whatever number your thumb drive happens to be assigned to). Diskpart should tell you that this is now the selected disk,
  5. Type “clean”. This will get rid of all the old information on the disk, as well as any partitions. Diskpart will tell you when this has succeeded.
  6. Type “create partition primary”. This sets up the new partition (one big one instead of a small one) for the drive.
  7. Type “select partition 1” to select the partition you just created.
  8. Type “active” to mark the selected partition as active.
  9. Type “format fs=ntfs quick” to format the drive. This may take a few minutes depending on the size of the drive.
  10. Type “assign”.
  11. Type “exit” to leave the Diskpart program.
http://nlb-creations.com/2013/01/17/removing-partitions-from-a-usb-thumb-drive/

2015年12月6日 星期日

[Latex] Linux Latex Lab Book Package


Diary is a useful practice for our daily research work.
We may need to trace back what have we done and what is planned ahead day by day.

It is quite tedious to have a single tex file / word stuff to manage all the stuff. So why not a full package which can do all the stuff automated?

Under Linux environment, you can:

  1. Automated the daily entry process ( Create / Edit today's entry )
    > script/dailyEntry.sh
  2. Build the diary automatically everyday (3 am)
    > cd script; ./autoBuild.sh

This work is based on previous work of Mikhail Klassen and licensed under Creative Commons Share Alike 3.0

Download Lab Book (labbook.tar.gz)
It has been a while for last update

2013年1月21日 星期一

[CentOS] Display Chinese Char

在自己的機器上裝了個CentOS5.5的虛擬機,做自己學習之用,今天想讓他支持中文,但是切換語言之後,中文顯示的都是方塊字,很是鬱悶,網上找了好 多文章,都是讓我修改、/etc/sysconfig/i18N這個文件,改完之後,注銷退出,沒用,重启好多次,也是沒用,後來看到原來只要安裝2個 RPM文件才可以:fonts-chinese-3.029-9.*.noarch.rpm   和 fonts-ISO8859-2*.rpm包之後再切換成中文,就搞掂了。。。

from: http://world77.blog.51cto.com/414605/472084

[CentOS] Mount NTFS HDD


  1. 下載 rpmforge rpm-release
  2. 執行
    rpm -Uhv rpmforge-release-0.3.6-1.$dist.rf.$arch.rpm

  3. 執行
    yum install dkms dkms-fuse fuse-ntfs-3g
  4. 完成 

from: http://tw.myblog.yahoo.com/weslyyen-0704/article?mid=1230

2013年1月9日 星期三

CentOS LVM Resize

Follow this steps:

Since the release of CentOS 5.5 we noticed that the default CentOS install assigns a considerable amount of its available storage space to Swap. If you don’t catch this during the installation don’t worry, Logical Volume Manager or LVM will rectify this post install.
LVM is a logical volume manager for the Linux kernel; it manages disk drives and similar mass-storage devices, in particular large ones. The term “volume” refers to a disk drive or partition thereof.

Before we start just some general housekeeping. The XEN virtual CentOS 5.5 server (base install) in this tutorial was assigned 10GB of storage with the default partitioning layout.
Let check the amount of disk space available on the file system.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
4.9G 2.4G 2.3G 51% /
/dev/xvda1 99M 23M 72M 25% /boot
tmpfs 4.0G 0 4.0G 0% /dev/shm
Let see the attributes of the logical volumes like size, read/write status, snapshot information
# lvdisplay
— Logical volume —
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID oFXKGg-nBPo-Fk27-3ino-zaHZ-cEcv-fk0dS0
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 160
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0
— Logical volume —
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID Ntffw7-dqPh-Rjhy-rWLv-BGA0-iGik-LoyHET
LV Write Access read/write
LV Status available
# open 1
LV Size 4.88 GB
Current LE 156
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1
Let’s begin but first turning off swap on the Swap Logical Volume
# swapoff /dev/VolGroup00/LogVol01
Once swap is off let’s take the disk space we require.
# lvresize -L -4GB /dev/VolGroup00/LogVol01
WARNING: Reducing active logical volume to 896.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
Reducing logical volume LogVol01 to 896.00 MB
Logical volume LogVol01 successfully resized
Now let’s add what we removed to the main Logical Volume.
# lvresize -L +4GB /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 9.00 GB
Logical volume LogVol00 successfully resized
Resize the File System
# resize2fs -p /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2359296 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2359296 blocks long.
Rebuild the swap partition.
# mkswap /dev/VolGroup00/LogVol01
Setting up swapspace version 1, size = 939520 kB
Turn swap on.
# swapon /dev/VolGroup00/LogVol01
Let’s check the amount of disk space available and LVM attributes to see if our changes took effect.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
8.8G 2.4G 6.0G 28% /
/dev/xvda1 99M 23M 72M 25% /boot
tmpfs 4.0G 0 4.0G 0% /dev/shm
# lvdisplay
— Logical volume —
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID oFXKGg-nBPo-Fk27-3ino-zaHZ-cEcv-fk0dS0
LV Write Access read/write
LV Status available
# open 1
LV Size 9.00 GB
Current LE 288
Segments 2
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0
— Logical volume —
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID Ntffw7-dqPh-Rjhy-rWLv-BGA0-iGik-LoyHET
LV Write Access read/write
LV Status available
# open 1
LV Size 896.00 MB
Current LE 28
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1
From: http://www.how2centos.com/centos-lvm-resizing-guide/
Read more: http://www.how2centos.com/centos-lvm-resizing-guide/#ixzz2HY0dzB6c

2012年10月23日 星期二

[Linux] 在linux下用上RAR防止在Window出現中文亂碼

请到http://www.rarlab.com/download.htm下载RAR 4.xx for Linux,

操作:

解压缩,运行终端,进入解压缩的目录命令行运行:sudo make install

建立软链接:sudo ln -s /usr/local/bin/rar /usr/bin

完成

使用方法:
rar a name.rar /location

Detail:
install: http://forum.ubuntu.org.cn/viewtopic.php?t=388114&p=2852436
rar manual: http://blog.csdn.net/guoguo1980/article/details/2310258

2012年8月22日 星期三

[Linux] 當進入linux OS recovery mode請注意

Under recovery mode時, 有某些電腦只會allow PS/2 keyboard operate. USB keyboard會沒有反應.

2012年7月3日 星期二

[Linux] Kernel Module with no symbol version

Situation:
Compiling Kernel Module with hierarchy / cross module dependency (say there are EXPORT_SYMBOL in the kernel)
when you insert the child-module, it may cause you following error:
.... Unknown Symbol

You may call the following for further information
$ dmesg
...

[19729.170980] xrawdata0: no symbol version for DmaRegister
[19729.170984] xrawdata0: Unknown symbol DmaRegister

This may occur for all kernel module with kernel version >= 2.6.26

Solution:
1. Divide the Makefile according to the Hierarchy.
2. Make the Base first and let it generate the "Module.symvers".
3. Copy the "Module.symvers" to the directory of the child modules
4.Continue your Compilation and keep renewl the Module.Symvers.

OR
You can make a link of "Module.Symvers" to your kernel source Directory at all your modules source directory to keep your Module.Sysmvers being updated.

Make sure you have run "make vmlinux" before any kernel module compilation. 

2012年7月1日 星期日

[Linux] Xilinx Cable Driver Can't be Compiled


Situation:

When you compile Xilinx Cable Drier with Linux Kernel >= 2.6.36
(when you run: $Xilinx/14.1/ISE_DS/common/bin/lin/install_script/install_drivers/install_drivers)

This may cause the following problem:

/vlsi/Xilinx/14.1/ISE_DS/common/bin/lin/install_script/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c:241:2: error: unknown field ‘ioctl’ specified in initializer

Solution:

Open:
$Xilinx/14.1/ISE_DS/common/bin/lin/install_script/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c

Add @ top:
#include <linux/slab.h>

@Line 163:
- int xpc4_ioctl (struct inode *inode, struct file *filp,
+ int xpc4_ioctl (struct file *filp,

@Line 240:
- .ioctl = xpc4_ioctl,
+ .unlocked_ioctl = xpc4_ioctl,



========

This may be useful while you try to install Xilinx Cable Driver.
The Kernel Module Driver is not compile-able after 2.6.36

Hacking Material

http://lwn.net/Articles/119652/
http://hi.baidu.com/kkernel/item/ea0ae8f4abb46929743c4c96