Pages

Saturday, November 1, 2014

Out of Space... Add a disk!

I have a lenovo Thinkpad T540p. This laptop has a Samsung 256GB SSD drive.  This drive ran out of space long ago.  The good thing is, you can add a disk to the T540p.  I went to lenovo's site and ordered:

After installing the drive, I had to figure out how to carve up the new space.  There are probably many ways to do this, but I knew I wanted to:
  • Add more space to the /dev/fedora/root LV.
  • Keep the new, slower disk in a separate VG.  I didn't want any LV's to span these two disks.
I decided to move the _home_ VG to the new disk.  That would free up ~ 200GB on the SSD drive.  I could then take that free space and grow the root LV.  I couldn't find a way to just move the LV from one disk to another when the disks are in a different VG.  Seems like you have to move the LV from one disk to another when the drives are in the same VG.  So, in short, what I needed to do was:
  • Add the new disk to the existing VG
  • Move the home data to the new disk
  • Split that disk out into it's own VG
  • Expand the root filesystem
So, Here are the steps I ended up taking:
  • fdisk /dev/sdb                                                 # create a partition on the new disk 
  • pvcreate /dev/sdb1                                        # create a new phyiscal volume from the new disk 
  • vgextend fedora /dev/sdb1                            # add the new physical volume to the existing Volume group that home is in 
  • pvdisplay -m                                                  # get list of extents for the volume group 
  • pvmove -v /dev/sda2:7500-57499 /dev/sdb1 # move home to new disk lvchange -an /dev/fedora/home                    # deactivate home 
  • vgsplit fedora VG_Home /dev/sdb1              # from fedora (old volume group), create a new volume group called VG_Home 
  • lvchange -ay /dev/VG_Home/home               # activate the volume 
  • mount /dev/VG_Home/home /home/             # test and see if data is still there 
  • vi /etc/fstab                                                   # make new volume avail on boot 
  • lvextend -L+20G fedora/root                       # add 20GB to my /root partition 
  • resize2fs /dev/fedora/root                            # resize root and add the extra space 
  • df -hal                                                           # confirm space is there 
And, wallah!  Now I have it set up the way I want.

No comments:

Post a Comment