linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: "Bryn M. Reeves" <bmr@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] lvreduce nightmare
Date: Fri, 18 May 2012 11:25:48 +0100	[thread overview]
Message-ID: <4FB623AC.9060900@redhat.com> (raw)
In-Reply-To: <20120517181350.2922a70b@bettercgi.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/18/2012 12:13 AM, Ray Morris wrote:
> Stop. Don't do anything else until you are sure of what to do next.
>  You will not lose data by studying. You can lose data by trying to
> fix it.
> 
>> resize2fs /dev/vg0/data 100G lvreduce -L -100G -n /dev/vg0/data*
> 
> A 100 GB filesystem needs a block device of around 110 GB.  So
> this cut off the end of your filesystem. (The device needs to hold
> the journal as well as the FS, for example.)

Not with most file systems. When you ask resize2fs to make a file
system 100G it will make it (within rounding limits) 100G's worth of
blocks in length. This is the actual space required on the disk (i.e.
the argument is the size of the file system image not the maximum free
space within it).

E.g.:

# lvcreate -L 100M -n l0 tvg0
  Logical volume "l0" created
# mke2fs -j /dev/tvg0/l0
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
25688 inodes, 102400 blocks
[...]

102400 1024-byte blocks is exactly 100M (MiB to be pedantic).

Resize to 50M gives:

# resize2fs /dev/tvg0/l0 50M
resize2fs 1.41.9 (22-Aug-2009)
Resizing the filesystem on /dev/tvg0/l0 to 51200 (1k) blocks.
The filesystem on /dev/tvg0/l0 is now 51200 blocks long.

51200 1024 byte blocks is exactly 50MiB.

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+2I6wACgkQ6YSQoMYUY96SlACfTAzVIzeym6iM3fzGhsR0P9YK
iG8Amwfu9AwTnwHvCUddMdzhKxlW0uCA
=+ITm
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2012-05-18 10:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 15:48 [linux-lvm] lvreduce nightmare tariq wali
2012-05-17 23:13 ` Ray Morris
2012-05-18  0:21   ` Stuart D Gathman
2012-05-18  1:16   ` Andy Smith
2012-05-18 10:25   ` Bryn M. Reeves [this message]
2012-05-18 14:13     ` tariq wali
2012-05-19 15:58       ` Stuart D Gathman
2012-05-19 23:14       ` Andy Smith
2012-05-20  8:59         ` tariq wali
2012-05-20 19:45           ` Andy Smith
2012-05-21  9:02           ` Bryn M. Reeves
2012-05-20 21:39       ` Raptorfan
2012-05-18  9:57 ` Bryn M. Reeves

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=4FB623AC.9060900@redhat.com \
    --to=bmr@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).