Increase A VMware Disk Size (VMDK) Formatted As Linux LVM

3) Partitioning the unalloced space

Once you’ve changed the disk’s size, either boot up your VM again, or restart if it was still running. Linux needs to boot with the new disk, so it can see you’ve added (unallocated) disk space.

Once you’ve booted again, you can check if the extra space can be seen on the disk.

lb02.lab.mojah.be ~ $ fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         391     3036285   8e  Linux LVM

So the server can now see the 10GB hard disk. Let’s create a partition, by start fdisk for the /dev/sda device.

lb02.lab.mojah.be ~ $ fdisk /dev/sda

The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n

Now enter ‘n’, to create a new partition.

Command action
e   extended
p   primary partition (1-4)
p

Now choose “p” to create a new primary partition. Please note, your system can only have 4 primary partitions on this disk! If you’ve already reached this limit, create an extended partition.

Partition number (1-4): 3

Choose your partition number. Since I already had /dev/sda1 and /dev/sda2, the logical number would be 3.

First cylinder (392-1305, default 392): <enter>
Using default value 392
Last cylinder or +size or +sizeM or +sizeK (392-1305, default 1305): <enter>
Using default value 1305

Note; the cylinder values will vary on your system. It should be safe to just hint enter, as fdisk will give you a default value for the first and last cylinder (and for this, it will use the newly added diskspace).

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)

Now type t to change the partition type. When prompted, enter the number of the partition you’ve just created in the previous steps. When you’re asked to enter the “Hex code”, enter 8e, and confirm by hitting enter.

Command (m for help): w

Once you get back to the main command within fdisk, type w to write your partitions to the disk. You’ll get a message about the kernel still using the old partition table, and to reboot to use the new table. Please obey kindly, and reboot the virtual machine.

After you’ve rebooted, you can see the newly created partition with fdisk.

lb02.lab.mojah.be ~ $ fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         391     3036285   8e  Linux LVM
/dev/sda3             392        1305     7341705   8e  Linux LVM

3) Extend your Logical Volume with the new partition

Now, create the physical volume as a basis for your LVM. Please replace /dev/sda3 with the newly created partition.

lb02.lab.mojah.be ~ $ pvcreate /dev/sda3
Physical volume “/dev/sda3″ successfully created

Now find out how your Volume Group is called.

lb02.lab.mojah.be ~ $ vgdisplay
— Volume group —
VG Name               VolGroup00

Let’s extend that Volume Group by adding the newly created physical volume to it.

lb02.lab.mojah.be ~ $ vgextend VolGroup00 /dev/sda3
Volume group “VolGroup00″ successfully extended

With pvscan, we can see our newly added physical volume, and the usable space (7GB in this case).

lb02.lab.mojah.be ~ $ pvscan
PV /dev/sda2   VG VolGroup00   lvm2 [2.88 GB / 0    free]
PV /dev/sda3   VG VolGroup00   lvm2 [7.00 GB / 7.00 GB free]
Total: 2 [9.88 GB] / in use: 2 [9.88 GB] / in no VG: 0 [0   ]

Now we can extend Logical Volume (as opposed to the Physical Volume we added to the group earlier). The command is “lvextend /dev/VolGroupxx /dev/sdXX“.

lb02.lab.mojah.be ~ $ lvextend /dev/VolGroup00/LogVol00 /dev/sda3
Extending logical volume LogVol00 to 9.38 GB
Logical volume LogVol00 successfully resized

If you’re running this on Ubuntu, use the following.

lb02.lab.mojah.be ~ $ lvextend /dev/mapper/vg-name /dev/sda3

All that remains now, it to resize the file system to the volume group, so we can use the space. Replace the path to the correct /dev device if you’re on ubuntu/debian like systems.

lb02.lab.mojah.be ~ $ resize2fs /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 2457600 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2457600 blocks long.

And we’re good to go!

lb02.lab.mojah.be ~ $ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 9.1G 1.8G  6.9G  21% /
/dev/sda1              99M   18M   77M  19% /boot
tmpfs                 125M     0  125M   0% /dev/shm

Filezilla 3.5.3 连接VsFTPd TLS问题

Response arg: error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher

/etc/vsftpd/vsftpd.conf

ssl_ciphers=HIGH

原因是

The default is DES-CBC3-SHA which seems that is not supported anymore by FileZilla

MySQL regex_replace Function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<pre>DELIMITER $$
CREATE FUNCTION  `regex_replace`(pattern VARCHAR(1000),replacement VARCHAR(1000),original VARCHAR(1000))

RETURNS VARCHAR(1000)
DETERMINISTIC
BEGIN
 DECLARE temp VARCHAR(1000);
 DECLARE ch VARCHAR(1);
 DECLARE i INT;
 SET i = 1;
 SET temp = '';
 IF original REGEXP pattern THEN
  loop_label: LOOP
   IF i&gt;CHAR_LENGTH(original) THEN
    LEAVE loop_label;
   END IF;
   SET ch = SUBSTRING(original,i,1);
   IF NOT ch REGEXP pattern THEN
    SET temp = CONCAT(temp,ch);
   ELSE
    SET temp = CONCAT(temp,replacement);
   END IF;
   SET i=i+1;
  END LOOP;
 ELSE
  SET temp = original;
 END IF;
 RETURN temp;
END$$
DELIMITER ;</pre>

FreeBSD PF 防火墙简单配置

1
2
3
4
5
6
oif="em0"
block in
pass out
pass in on $oif proto tcp to ($oif) port = 5631
pass in on $oif proto tcp from 192.168.0.0/24 to ($oif) port = 3128
pass in on $oif proto tcp to ($oif) port = 80

Gentoo emerge 更新系统方法

  1. 更新Portage树
    # emerge --sync
  2. 更新系统
    # emerge --update --deep --newuse world
  3. 移除依赖包
    # emerge --depclean
    # revdep-rebuild

小心重庆美联英语的注册金骗局

上周末去重庆观音桥的美联英语咨询情况,结果被里面的要求交什么注册金,300元(因为我只带了300元)。但我第二天回来在Google、百度上搜索他们情况后发现并不是我理想中的那样。当我提到退款时,就说不能退的啦。我立马打12315电话。我说明情况之后,重庆12315的工作人员,只问了一句“他是培训机构吗?”。我说“是”。“那你打教委的电话”,“请问教委的电话是多少呢?”。“你自己打114查询啊”。

……

天啊,这也叫便民?难道真把我们当便民了?当然我没有打教委的电话,说实话,我是第一次打12315在我心中一直是能够为消费者办事的电话,结果呢?我已经对这些所谓的“服务”失去信心了。以后还是小心点算了吧。

让我们来看看一些有趣的东西吧:

更多相关信息请看留言。

NFS quick howto for centos 5

NFS quick howto for centos 5

To use nfs successfully, you have to configure the server and the client. In this example, the client is 192.168.0.3 and the server is 192.168.0.1. The folder to be shared is /home/sharing, and to be mounted to /mnt on the client

On the server

  1. Make directory that you want to use.
    • # mkdir /home/sharing
  2. Edit /etc/exports, insert the client machine’s ip
    • # vi /etc/exports
    • Add this line:
    • /home/sharing 192.168.0.3/255.255.255.255(rw,sync)
  3. Save
  4. Edit /etc/hosts.allow
    • # vi /etc/hosts.allow
    • Add this line:
    • portmap: 192.168.0.0/255.255.255.0
  5. Save
  6. Start nfs and portmap
    • # /etc/init.d /nfs start
    • # /etc/init.d/portmap start
On the client
  1. Start portmap
    • # /etc/init.d/portmap start
  2. Mount the nfs folder
    • # mount 192.168.0.1:/home/sharing /mnt
  3. Check /var/log/messages for any error that might occur
    • # tailf /var/log/messages
  4. Use mount to check if the folder is mounted properly
    • # mount 
    • This should be the output:
    • 192.168.0.1:/home/sharing on /mnt type nfs (rw,addr=192.168.0.1)
  5. Edit /etc/fstab to mount the shared folder on boot
    • # vi /etc/fstab
    • Add this line
    • 192.168.0.1:/mnt/sdb1/backup /mnt nfs rw,hard,intr 0 0
  6. Save
You can use 'man exports' to see the options available for /etc/exports

Continue reading ‘NFS quick howto for centos 5′

Web应用安全分析工具

http://sectools.org/web-scanners.html

 

 

 

 

Squid 2.7 通过域名反向代理多个服务器配置

visible_hostname squid1.abc.com

#设定squid的主机名,如无此项squid将无法启动

http_port 80 accel vhost vport

#设定squid为accel加速模式,vhost必须要加.否则将无法将主机头转发至后端服务器,访问时就会出现无法找到主机头的错误

cache_peer 192.168.1.88 parent 80 0 no-query originserver name=contentchina

cache_peer 192.168.1.88 parent 80 0 no-query originserver name=bbs

cache_peer 192.168.1.1 parent 80 0 no-query originserver name=ihompy

#定义不同的父节点,将节点设为no-query以及originserver说明这些节点是实际服务器

cache_peer_domain contentchina aaa.abc.com

cache_peer_domain bbs bbb.abc.com

cache_peer_domain ihompy ccc.abc.com

#设定不同域名转发到不同的cache_peer上,如果没有这项.不同域名的域名可能被分发到同一台服务器上.

acl all src 0.0.0.0/0.0.0.0

no_cache deny all

http_access allow all

#允许所有客户端访问

cache_log /var/log/squid/cache.log

#记录日志

#***********ACL存取控制*************

#acl QueryString url_regex .php?

#***********缓冲存取控制*************

#no_cache deny QueryString

#不对符合QueryString的ACL内容进行缓冲

#***********性能优化配置*************

maximum_object_size 320010 KB

#大于此容量的对象将不会被保存在磁盘上,默认大小是4M,如果squid服务器用于缓冲flash等大型文件,建议将此值变大.否则过大的文件在下次重启后将需要重新获取

maximum_object_size_in_memory 100 KB

#最大位于内存中的对象的大小,默认大小是8K,如果服务器内存很大.可以适当提高此值的大小,建议根据网站的80%图片的大小来定.或者根据WEB服务器实际存取文件中最常访问的文件大小来定制

#***********其他可选配置*************

#dns_nameservers 10.0.0.1 192.172.0.4

#配置DNS服务器地址.获取后端时将从此dns获取IP地址

#cache_mgr [email protected]

#在错误日志中出现的webmaster地址.

HTML颜色图表

http://fred.oracle1.com/~fred/pages/colors.html

做网站配色的好工具。