Tuesday, January 21, 2014

Extending an ext3 partition with LVM


LVM is quite technical but very powerful, here is extending an ext3 filesystem that is stored on a logical volume under Linux LVM.

Starting with a spare disk, setup with 4 LVM partitions:

[root@hpmicro ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        9727    78132096   8e  Linux LVM
/dev/sdb2            9728       19454    78132127+  8e  Linux LVM
/dev/sdb3           19455       29181    78132127+  8e  Linux LVM
/dev/sdb4           29182       38913    78172290   8e  Linux LVM


I make the first two into a LVM ext3 filesystem:

[root@hpmicro ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@hpmicro ~]# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created

Create a volume group "TempVG" that uses these two partitions:

[root@hpmicro ~]# vgcreate TempVG /dev/sdb1 /dev/sdb2
  Volume group "TempVG" successfully created

Create a logical volume that uses storage from TempVG:

[root@hpmicro ~]# lvcreate --name TempVol00 --size 140G TempVG
  Logical volume "TempVol00" created

Create the filesystem on the logical volume:

[root@hpmicro ~]# mkfs -t ext3 /dev/TempVG/TempVol00


Mount the filesystem

[root@hpmicro ~]# mkdir /store
[root@hpmicro ~]# mount /dev/TempVG/TempVol00 /store

Now create the other two PV's:

[root@hpmicro disc]# pvcreate /dev/sdb3
  Physical volume "/dev/sdb3" successfully created
[root@hpmicro disc]# pvcreate /dev/sdb4
  Physical volume "/dev/sdb4" successfully created

Extend the existing volume group:

[root@hpmicro disc]# vgextend TempVG /dev/sdb3 /dev/sdb4
  Volume group "TempVG" successfully extended

Extend the logical volume:

 lvresize -L+150G /dev/mapper/TempVG-TempVol00
  Extending logical volume TempVol00 to 290.00 GB
  Logical volume TempVol00 successfully resized


Now resize the filesystem on that logical volume (checking with df sizes before and after):

[root@hpmicro disc]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/TempVG-TempVol00
                      138G  4.8G  127G   4% /store

[root@hpmicro ~]# resize2fs  /dev/mapper/TempVG-TempVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/TempVG-TempVol00 is mounted on /store; on-line resizing required
Performing an on-line resize of /dev/mapper/TempVG-TempVol00 to 76021760 (4k) blocks.
The filesystem on /dev/mapper/TempVG-TempVol00 is now 76021760 blocks long.


[root@hpmicro ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/TempVG-TempVol00
                      286G  191M  271G   1% /store


Wednesday, January 1, 2014

Linux: Install ISO image from DVD (CentOS6)

From: http://wiki.centos.org/HowTos/InstallFromUSBkey

1.  Use fdisk to setup partitions (about 250M for the boot partition, "a" makes bootable):

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          43      247657+   b  W95 FAT32
/dev/sdc2              44        5324    30418560   83  Linux


2. Make filesystems:

mkfs.vfat -n BOOT /dev/sdc1
mkfs.ext3 -m 0 -b 4096 -L DATA /dev/sdc2

3. Copy the isolinux directory from the DVD1 to the first /dev/sdc1 partition root.

4. Rename isolinux to syslinux.  Rename syslinux/isolinux.cfg syslinux/syslinux.cfg

5. Copy the images directory from DVD1 to the /dev/sdc1 partition root.

6. Create syslinux boot on the /dev/sdc1 partition.  syslinux /dev/sdc1

7. Mount the /dev/sdc2 partition and copy the .iso files to the root.

8. During install Ctrl-Alt-F2 umount /mnt/isodir ;  mount /dev/sda2 /mnt/isodir - as the installer needs to point to where the .iso files are kept.


Film: The Lives of Others Directed by Florian Henckel von Donnersmarck

A foreign language film about life in East Germany under Stasi rule.  It centres around the observation of a subversive playwright who has been placed under surveillance.

The officer in charge however becomes drawn into the lifes of those he is monitoring, to the point of withholding incriminating information. 

The playwright manages to get an article published in the west about the covering up of suicide figures, which causes a storm in the party circles - eventually the agent is demoted to "steaming envelopes" for perceived incompetence.

When East Germany is re-united with the fall of the Berlin wall - the playwright finds out about this and dedicates his latest work to him.