Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, August 18, 2009

Sort installed RPMs by size

Keep forgetting this one, to list all RPM packages installed on a Linux (Red Hat / CentOS) machine sorted from the largest to the smallest in size:

rpm -qa --queryformat '%{size} %{name}\n' | sort -rn | more

This outputs something like this:

[root@healthy ~]# rpm -qa --queryformat '%{size} %{name}\n' | sort -rn | more
87389896 kernel
66720559 glibc-common
35274936 perl
30873913 valgrind
28767659 selinux-policy-targeted
27805586 redhat-logos
27022854 valgrind
26982540 mesa-libGL
24517704 mesa-libGL
22091978 python
20474820 specspo


Monday, June 15, 2009

How to mount an LVM partition

This details the commands I had to run to mount a CentOS 5.1 main disk into another machine. Because of LVM using mount on standard scsi partitions is not enough.

Assuming main physical disk: /dev/sda
Second physical disk: /dev/sdb
  1. Run pvscan to list the physical volumes found in any block device of the system. Among error lines this returned PV lines for /dev/sda2 and /dev/sdb2. On the same line was the name of the volume group, in my case 'sysvg'
  2. Made the 'sysvg' volume group active by typing lvchange -ay sysvg. This created a new entry in the /dev/sysvg
  3. Doing an ls /dev/sysvg showed the different volumes under that volume group, from there simply had to do: mount /dev/sysvg/root.vol /mnt
  4. When done: umount /mnt && lvchange -an sysvg