GNU Linux


HOWTO - How I configure my Hard disks


There should be a blue line here

Table of Contents

There should be a blue line here

1. HOWTO:make the SWAP space span 3 disks with stripping.

Once the system is installed do not forget to configure the priority of the swap spaces. If the priority is set correctly then all your swap spaces will be used as it they are stripped making it faster.

To see the current swap space setup use the command :

Code:
swapon -s 

The last column "Priority should be the same for all three areas or you will not see the performance gain. In /etc/fstab for the three swap mount lines replace the none with swap and add pri=1, to the sw. As in:-

Example
UUID=34a54a33-3b43-f53d45345 swap swap pri=1,sw 0 0 

You can "stop" and "start" the swap space with :-

Code:
swapon -a 
swapoff -a 

I found this gem of information, but have lost the original link. I think it was from the Ubuntu formus. Thanks .

If you end up getting a corrupt swap space you can reinitialise it with the following:

Code:
sudo swapoff <device> 
sudo mkswap -v1 <device> 
sudo swapon <device> 

You can also add a label so you can mount with something like this:

Example
LABEL=swap1 swap swap pri=1,sw 0 0 
LABEL=swap2 swap swap pri=1,sw 0 0 
LABEL=swap3 swap swap pri=1,sw 0 0 

To use labels on swap partitions you need to turn off the swap area add the label and turn it back on

Code:
sudo swapoff -a 
sudo mkswap -L swap1 /dev/sda2 
sudo mkswap -L swap2 /dev/sdb2 
sudo swapon -a 

There should be a blue line here

2. HOWTO:When using RAID 5, why is the HD light on all the time.

After the install and for the next hour or so there will be high disk activity as the RAID 5 array works through its initialisation for the parity part. To see the progress just run the following in a window. You can continue to use your system while this happens.

Code:
cat /proc/mdstat 

There should be a blue line here

3. HOWTO: Create a partition on LVM.

Code:
sudo lvcreate -L5G -i3 -I64 -n lv_root2 vg01 

Creates new logical volume of 5 Gbyte striped over 3 disks block size is 64K called lv_root2 on volume group vg01. All that is left is to put the file system on the new stripped partition.

Code:
sudo mkreiserfs /dev/vg01/lv_root2 

You can check all was created as expected with the following:

Code:
sudo lvs -o +stripes 

There should be a blue line here

4. HOWTO: Create a Snapshot on LVM.

With Gusty all the software should already be installed.

Create a snapshot from the shell prompt. We are going to make a 10Gb snapshot called lv_snap of the real partition /dev/vg01/lv_home our current home partition. We will then mount it at /mnt/snapshot

Code:
sudo  lvcreate -L10G -s -n lv_snap /dev/vg01/lv_home 
 Logical volume "lv_snap" created 
 
sudo mkdir /mnt/snapshot 
sudo mount /dev/vg01/lv_snap /mnt/snapshot 

Do your backups or whatever it was you wanted to do.

Code:
  sudo umount /mnt/snapshot 
  sudo lvremove /dev/vg01/lv_snap 
Do you really want to remove active logical volume "lv_snap"? [y/n]: y 
  Logical volume "lv_snap" successfully removed 

All done

There should be a blue line here

5. HOWTO: Extend a partition on LVM.

First display the names of the logical volumes, so you know the name of the lv you are goingto extend.

Code:
sudo lvdisplay 

Te command above will tell you, if you named your lvm disks with a little for thought, which volume group the logical volume is in. Use te command below to find the VG and see how much free space is still left unallocated.

Code:
sudo vgdisplay 

To extend a lv by adding a further say 40Gb

Code:
sudo lvextend -L+40G /dev/vg01/lv_data 

and then resize the file system asuming you use reisersfs. If you use ext3 or other you may have to umount your partition to resize.

Code:
sudo resize_reiserfs -f /dev/mapper/vg01-lv_data 

There should be a blue line here

6. HOWTO: Setup read/write access to local NTFS drives.

Install ntfs-3g, Then you can mount the disk with the mount command or at boot time and use read/write.

Code:
 sudo apt-get install ntfs-3g 
 sudo mount -t ntfs-3g /dev/sda1 /media/win_c 

And in your /etc/fstab add a line like this.

Example
/dev/sda1 /media/win_c ntfs-3g defaults,umask=007,gid=46 0       7 

There should be a blue line here

7. HOWTO: Install system-config-lvm tool.

LVM system config tool

It is rather pretty but not really that functional and cannot use reiserfs :-(

There should be a blue line here

8. HOWTO: use Logical Volume Manager (LVM2)

Feisty LVM HOWTO