From: James Hawtin <oolon@ankh.org>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] Replace small drive with bigger, using LVM?
Date: Wed, 10 Sep 2014 10:36:54 +0100 [thread overview]
Message-ID: <54101BB6.3020700@ankh.org> (raw)
In-Reply-To: <5410138C.9010603@cemery.org.uk>
Ok this is such an easy bread and butter task, but its really easy to
get wrong so be careful! You have 7 tasks here, you will notice not all
your OS is on lvm a small part /boot is on its own partition and you
need to copy that as well to get you os to boot.
I am assuming here your second disk is called sdb.
Task 1) fdisk
fdisk /dev/sdb
c
p
1
2048
499711
a
1
c
p
2
<return>
<return>
t
8e
Task 2) Copying /boot
mkfs.ext3 /dev/sdb1
mkdir /boot2
mount /dev/sdb1 /boot2
cd /boot
tar -cPpSslf - . | ( cd /boot2 ; tar -xvPpSslf -)
umount /boot2
change /etc/fstab to us /dev/sda1 for how to reference /boot
Task 3) moving lvm... easy!
pvcreate /dev/sdb2
vgextend ubuntu-vg /dev/sdb2
swapoff -a
pvmove /dev/sda5 /dev/sdb2
vgreduce ubuntu-vg /dev/sda5
And now the tricky bit!
task4) Install grub on your new drive
Hopefully this is right... if not your need task 6.
grub-setup /dev/sdb
task5) Turn off your computer.
swap sda and sdb
and boot from your new drive.
check /boot is comming from the right device (/dev/sda1), if not unmount
and mount it, then install a new kernel. This is the easiest way to get
it to build a new initrd.
Shut down your computer remove /dev/sdb (old disk)
and you should be able to boot from just your new drive... SIMPLEZ!
Task 6) If you computer does no boot.
boot the ubuntu install disk and use rescue to install the grub boot
block and verify /boot is mounted and populated with data. If not ... fix.
Task 7) I have no new space. Yes you do use pvs its just unallocated,
use either lvextend or lvcreate to extend or create a new logical
volume, if you extend you will then need to use resize2fs for make he
filesystem bigger, personally I would create a new mount point and not
use / for everything.
James
next prev parent reply other threads:[~2014-09-10 9:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 9:02 [linux-lvm] Replace small drive with bigger, using LVM? Craig
2014-09-10 9:36 ` James Hawtin [this message]
2014-09-10 9:39 ` Joe Thornber
2014-09-10 12:35 ` Fran Garcia
2014-09-10 13:03 ` James Hawtin
2014-09-10 13:34 ` Michael D. Setzer II
2014-09-10 10:13 ` Jarkko Oranen
2014-09-11 10:54 ` Andreas Nastke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54101BB6.3020700@ankh.org \
--to=oolon@ankh.org \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.