Category Archives: Linux

How to resize a LVM volume

0
Filed under Linux
Tagged as , , , , , , , ,

Here’s a quick run-down on how to resize an existing LVM volume on Linux. I’m currently using LVM2.

Let’s see what LVM volumes I have configured right now:

[root@Rudi-PC ~]# lvscan
ACTIVE ‘/dev/vg_rudipc/swap’ [5.80 GB] inherit
ACTIVE ‘/dev/vg_rudipc/var’ [2.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/home’ [20.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/root’ [8.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/data’ [10.00 GB] inherit

I used lvscan for this, but you can also use lvs or lvdisplay to get more info on the volumes.

Now, I want to resize the data partition, so I run the following:

[root@Rudi-PC ~]# lvresize /dev/vg_rudipc/data -L +10GB
Extending logical volume data to 20.00 GB
Logical volume data successfully resized

With lvresize, I basically told LVM to resize the data lv with 10GB extra storage (with the -L +10GB switch) inside the vg_rudipcPV vg

As you can see below, the logical volume has been increased by 10GB.

[root@Rudi-PC ~]# lvscan
ACTIVE ‘/dev/vg_rudipc/swap’ [5.80 GB] inherit
ACTIVE ‘/dev/vg_rudipc/var’ [2.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/home’ [20.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/root’ [8.00 GB] inherit
ACTIVE ‘/dev/vg_rudipc/data’ [20.00 GB] inherit

This is the easy part. Now you still need to tell Linux that the LVM partition was resized.

[root@Rudi-PC ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rudipc-root
7.9G 3.8G 3.8G 51% /
/dev/sda1 194M 15M 170M 8% /boot
/dev/mapper/vg_rudipc-var
2.0G 230M 1.7G 12% /var
/dev/mapper/vg_rudipc-home
20G 297M 19G 2% /home
tmpfs 2.0G 1.3M 2.0G 1% /dev/shm
/dev/mapper/vg_rudipc-data
9.9G 151M 9.2G 2% /data

As you can see, /data is still only 10GB, not 20GB as it is on the LVM partition

Now I resize the “/data” partition, using resize2fs

[root@Rudi-PC ~]# resize2fs /dev/vg_rudipc/data
resize2fs 1.41.4 (27-Jan-2009)
Filesystem at /dev/vg_rudipc/data is mounted on /data; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_rudipc/data to 5242880 (4k) blocks.
The filesystem on /dev/vg_rudipc/data is now 5242880 blocks long.

Now, when I check the space, I can see that it’s been resized:

[root@Rudi-PC ~]# df -h /data
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rudipc-data
20G 156M 19G 1% /data

Note: I used “df -h /data” to view the size of only the data partition, just to make it easier to process :)

Further reading:

  • http://tldp.org/HOWTO/LVM-HOWTO/
  • http://linux.die.net/man/8/lvm
  • http://www.linux.org/docs/ldp/howto/LVM-HOWTO/lvm2faq.html
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

How to encrypt & protect your portable data, on a USB HDD or memory stick

0
Filed under HOWTO\'s, Linux

I often travel with work, and most of the times I carry a portable USB HDD (in my case I have a 100GB laptop SATAII HDD, in a Vantec E-SATA / USB enclosure), or a large USB Memory Stick. The USB HDD enclosure basically dock’s into a “docking station” in the PC, which then connects it to the high speed SATA II bus and I can use it as any other Hard Drive in my PC.

When I’m on the move, it works with USB ( I didn’t want to carry an external power supply) and is small and lightweight.

The biggest problem I faced was that a lot of data on the portable HDD was private, and I didn’t want other people to get their hands on it. I carry client’s website projects (for when I want to work on it, or demo it to the clients), photos (for my photography – when I want to show it to someone, work on it, print it, etc), my business’s accounting info, and other private documents.

I also work a lot between Linux & Windows machines, so I needed something which is compatible with both operating systems. Accessing Linux’s EXT3 file system from Windows is fairly easy, and also accessing Windows FAT32 from Linux was easy, but I prefer to use Linux’s EXT3 cause the average non-Linux user wouldn’t know what todo with the drive if they got it. BUT, that doesn’t mean that a Linux user can’t access the data. So I needed better protection. After searching, and asking around, someone suggested TrueCrypt.

TrueCrypt can encrypt a disk, partition, or file and works very well. From what I’ve read on their website, there’s no back door, and no way to crack the encryption (unless you have access to a RoadRunner,  Cray or Blue Gene, or any other Super Computer) It supports many encryption algorithms and it can even create hidden encrypted partitions and operating systems.

From download, to install, to encrypting my first partition, was a breeze. It probably took me about 15 minutes in total. Once encrypted, I could mount the hidden Hard Drive, and safely store all my important data on it.

When on the move, I know that my data on is safe. I can just plug the hard drive / memory stick into another PC, install TrueCrypt, mount it and then use my data.

Last night I also encrypted my games Hard Drive on my PC, and soon I’ll be encrypting every other Hard Drive I own, to keep all my data safe from prying eyes & thieves.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

Great list of Linux commands

0
Filed under Linux
Tagged as , , ,

This is quite a nice list of UNIX & Linux commands: http://cb.vu/unixtoolbox.xhtml

Very handy for any Linux or UNIX admin

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

playing with clusters

1
Filed under Linux

I found this cool game on clusters: http://www.rcac.purdue.edu/rackanode/ you basically need to build a cluster, and then process some data with it. You start off with some cash and need to choose your first server. Once the server is in place you’ll get some data to process and some more cash upon successful processing the data. Now you can add more servers to the cluster and process more demanding data.

Enjoy :)

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

Setting up a Linux XEN Cluster

2
Filed under Linux

So, I want to start looking into setting up a XEN cluster on Linux, which will provide high-uptime for Linux & Widows guest operating systems.

This will be my first attempt to this, so I’m treading in deep waters, but it should be fun setting up. It’s rather late right now, so I’m not getting into anything at the moment, and I need a spare machine or 2 to setup the cluster.

So, to get started, I’ll be working through these URL’s:
http://www.sandervanvugt.com/heartbeat/xenhadoc.pdf
http://te.to/~ts1/xen_cluster.html
http://www.howtoforge.com/ganeti_xen_cluster_management_debian_etch
http://librenix.com/?inode=12733
http://searchenterpriselinux.techtarget.com/tip/0,289483,sid39_gci1294585,00.html

Since I’m going to run CentOS, I assume my setup will differ quite a lot from these links, but it’s a start.

The following article on super computers was quite good: http://www.webstreet.com/super_computer.htm

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

How to change file & folder permissions recursively in Linux

0
Filed under Linux, cPanel

Often times it’s necessary to change the permissions on many files & folders recursively – i.e. change the permisssions on every file & folder.

Todo so, login to your Server via SSH, and run the following commands as root.

1
2
3
 
find /home/username/public_html/ -type d -exec chmod 755 {} \;
find /home/username/public_html/ -type f -exec chmod 644 {} \;

The first line will change all folders (the “d” specifies directory) to mode 755
The second line will change all files to mode 644.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

List of useful Linux system management scripts

0
Filed under Linux

I was looking for a way to properly monitor XEN VPS’s traffic, when I found this site: http://wikicompany.org/fs//system_management.html#traffic_accounting

It has a long list Linux system management scripts

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

Interesting Linux & Windows compatible chat program

0
Filed under Linux

For quite some time I’ve used BorgChat for Windows networks, and it works very well as a local chat client between users on the LAN, without having to use extra internet bandwidth.

Recently, however, I wanted to join a Linux desktop to the Borgchat network, but since Borgchat doesn’t work on Linux, I need to find something else that does.

So, I found the following: QChat
According to their website it will work on Linux, and Windows. So, let’s see what it does :)

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis

help! CentOS 5.1 + Xen kernel doesn’t see all the RAM in my PC

0
Filed under Linux

I’ve run into quite a few odd issues with CentOS 5.1 x64 & the Xen kernel. One of them being the fact that it only sees about 480MB RAM, even though my server has 2GB RAM. So, searching the net, I came across this post: https://bugzilla.redhat.com/show_bug.cgi?id=250299 which states that grub-0.97-13 has a problem with mapping all the memory with a Xen kernel. The fix? Simple, upgrade to grub-0.97-14, with the following commands: [shell] rpm -Uvh ftp://ftp.zouric.com/public/grub-0.97-14.x86_64.rpm [shell] This will install grum 0.97.14. Once done, you need to reinstall grub to the HDD as well, like so: [php] grub-install /dev/sda [/php] PLEASE NOTE: This statement assumes you boot from /dev/sda by default. If you have IDE HDD’s, you need to use /dev/hda

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis