0

I have two physical hard drives and the set up looks like this:

http://prntscr.com/bhyu4k

I need to partition the sdb1 (fdisk), create ext4 filesystem based on the type that is used on sda (mkfs command), and mount it to /home. I want the home directory do be sda3 plus the whole sdb in size.

What would be the best way of doing this?

Thanks.

Tom Smith
  • 13
  • 2

1 Answers1

0

LVM:

no need to partition /dev/sdb
create PV of /dev/sdb
create VG with /dev/sdb
create LV on VG
format LV
mount LV in temporary location
copy /home to temporary location
umount LV
umount /home
mount LV to /home
make PV of /dev/sda3
add sda3 PV to VG
resize /home LV
resize /home filesystem

voila!

tim
  • 1,217
  • 3
  • 11
  • 23
  • Is LVM a better round than the standard way? I wont have any more disks later on as this is not possible, and I am not likely to be moving anything around too. – Tom Smith Jun 19 '16 at 09:03
  • What standard way? LVM is pretty much the only way you can achieve "the home directory do be sda3 plus the whole sdb in size". – Henrik supports the community Jun 19 '16 at 09:39
  • Ok :) This is good, as I will be finally able to start working on this. – Tom Smith Jun 19 '16 at 09:42
  • Would I need to make sda1, sda2, and sda4 part of the new LVM system too (they have been created in a standard way)? What are the steps 6-10? I dont have anything under /home and nothing there needs to be moved or preserved, if that would make a difference. – Tom Smith Jun 19 '16 at 09:55
  • Maybe I should do something like this instead? A) create PV of /dev/sdb B) create PV of /dev/sda3 C) create VG with /dev/sdb and /dev/sda3 PV's D) create LV of these new VG E) format with ext4 F) mkdir /home on that. And also, again, just leave the sda1, sda2, and sda4 as is with this? – Tom Smith Jun 19 '16 at 10:20
  • I would also mount the LV on /home as step G) – Tom Smith Jun 19 '16 at 10:30
  • Steps / questions: 1) LVM work has never been done on this system. sda, sda1, sda2, (sda3), sda4 can be left as is? They are set up the standard way. 2) There is no need to partition the sda3 as 8e (the LVM type)? 3) Do not create a parition on sdb, or maybe create a partition of the LVM type (8e)? 4) pvcreate /dev/sdb - create a physical volume 5) pvcreate /dev/sda2 - create physical volume 6) vgcreate volgrp1 /dev/sdb /dev/sda2 - create volume group named volgrp1 – Tom Smith Jun 19 '16 at 11:00
  • 7) lvcreate volgrp1 (can define size, name and probably other things, but this is the most basic form, default naming convention will be used) 8) create an ext4 filesystem on it, just like with regular partitions 9) mkdir /home 10) mount lvol1 (default name given by the lvcreate command) on it 11) So the (sda), sda1, sda2, sda4 will be non-lvm and thats ok? – Tom Smith Jun 19 '16 at 11:00
  • Everything you wrote seems OK. – tim Jun 20 '16 at 11:00