Computer upgrade

A failed powersupply was my excuse to upgrade most of the other internals of the desktop computer too. Some notes on adding a disk to LVM, following Suji's notes from 2007 (all of these require sudo):

  • fdisk /dev/sdd

    (create a primary partition, type "8E" Linux LVM, exit with "w")

  • mkfs -t ext3  /dev/sdd1

    (this will create the file-system. option "-c" which checks for bad sectors is recommended by some, but takes ages to complete) (see comments)

  • pvcreate /dev/sdd1

    (this will create a physical volume)

  • pvdisplay

    will now list all the physical volumes and the newly created one should be visible.

  • vgdisplay

    will list the volume groups. On my machine there's one named "datadisk"

  • vgextend datadisk /dev/sdd1

    (this will extend the volume group with the new disk)

  • vgdisplay -v datadisk

    will now display info on the volume group. The new disk should show up in the list of physical volumes.

  • lvextend -l100%VG /dev/datadisk/data

    (this will extend the logical volume so that the new size is 100% of available space in the volume-group)

  • resize2fs /dev/datadisk/data

    (this will resize the logical volume. takes a long time to complete with big disks and there is no progress bar/display)

  • finally you can check that the mounted volume group is actually re-sized to the new size and has lots of free space:
    df -h
    

There is more info in the LVM-HOWTO.

One thought on “Computer upgrade”

  1. Hi Anders,

    just for completeness: you can omit this step:
    mkfs -t ext3 /dev/sdd1
    This filesystem will be lost as soon as you run pvcreate anyway. Maybe it was recommended only for the sake of the bad sectors test?

    Good luck with the new hardware!
    Lars

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.