[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lvm and replacing disk



>>>>> "Andy" == Andy Smith <andy@lug.org.uk> writes:

    Andy> Yes.  I'll assue that your first disk is /dev/sda and your
    Andy> second one is /dev/sdb.

My current 400Gb is sda (SATA), the 80Gb (that will eventually be
removed) is hdb and my (soon to arrive - I hope :) will then be
sdb (also SATA).

    Andy> If your current logical volumes are small enough to all fit
    Andy> on /dev/sda then all you need to do is:

sda does NOT have enough space on it. It's already full (hence the 80Gb
disk). So according to the HOWTO, you just add the new disk to the
group/volume, move hdb to sdb (with pvmove), then remove hdb using
(vg,lv)reduce.

    Andy> you'll need to resize2fs to shrink filesystems

This part was what I didn't quite understand. Granted, i'm not sure
how a filesystem actually works (never needed to know :).

Maybe a picture will try to explain how I think/thought it worked.


Before the move:
+-------------------------+----------------+-------------------------+
| sda fs (~380Gb)         | hdb fs (~74Gb) | sdb fs (~380Gb) (empty) |
+-------------------------+----------------+-------------------------+

After the move:
+-------------------------+----------------+-------------------------+
| sda fs (~380Gb)         |                | sdb fs + hdb fs         |
+-------------------------+----------------+-------------------------+

Now, if I remove the middle disk, there will be a hole in the middle,
so I (or resize2fs ?) needs to 'move' the content at the end (sdb+hdb
data) to directly AFTER the data of sda...

+-------------------------+-------------------------+----------------+
| sda fs (~380Gb)         | sdb fs + hdb fs         | fs hole+nodev  |
+-------------------------+-------------------------+----------------+

In this situation, the fs hole can now be safely removed/shrinked/reduced
by resize2fs...


Will resize2fs figure this out itself, or do I need something else?


Note that at the time sdb arrives, both sda and hdb will be 100% full
with data...
-- 
nuclear ammonium Semtex FBI Noriega munitions Waco, Texas fissionable
DES attack president Nazi Legion of Doom quiche counter-intelligence
[See http://www.aclu.org/echelonwatch/index.html for more about this]
[Or http://www.europarl.eu.int/tempcom/echelon/pdf/rapport_echelon_en.pdf]
If neither of these works, try http://www.aclu.org and search for echelon.
Note. This is a real, not fiction.
http://www.theregister.co.uk/2001/09/06/eu_releases_echelon_spying_report/
http://www.aclu.org/safefree/nsaspying/23989res20060131.html#echelon



Reply to: