From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: kreijack@inwind.it, linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [btrfs-progs] Bug in mkfs.btrfs -r
Date: Fri, 1 Sep 2017 07:49:05 -0400 [thread overview]
Message-ID: <67a445ef-ce53-534a-8473-a5057b64d0fa@gmail.com> (raw)
In-Reply-To: <9fd28041-3f49-4dc7-d4a3-120edfe47964@inwind.it>
On 2017-08-31 16:29, Goffredo Baroncelli wrote:
> On 2017-08-31 20:49, Austin S. Hemmelgarn wrote:
>> On 2017-08-31 13:27, Goffredo Baroncelli wrote:
>>> Hi All,
>>>
>>>
>>> I found a bug in mkfs.btrfs, when it is used the option '-r'. It
>>> seems that it is not visible the full disk.
>>>
>>> $ uname -a Linux venice.bhome 4.12.8 #268 SMP Thu Aug 17 09:03:26
>>> CEST 2017 x86_64 GNU/Linux $ btrfs --version btrfs-progs v4.12
>> As far as I understand it, this is intended behavior. Tools that
>> offer equivalent options (genext2fs for example) are designed to
>> generate pre-packaged system images that can then be resized to fit
>> the target device's space. As an example use case, I do full system
>> image updates on some of my systems (that is, I keep per-system
>> configuration to a minimum and replace the entire root filesystem
>> when I update the system) I use this option to generate a base-image,
>> which then gets automatically resized by my update scripts to fill
>> the partition during the update process.
>
> Sorry, but I am a bit confused. If I run "mkfs.btrfs -r ...." on a partition... how I can detect the end of the filesystem in order to cut the unused space ?
>
> From your explanation I should do
>
> # mkfs.btrfs -r <source> /dev/sdX
>
> then
>
> # dd if=/dev/sdX of=/tmp/image bs=1M count=NNNN
>
> What I have to put in NNNN ?
Mount the filesystem, and see what size `btrfs filesystem show` reports
for the device, then go just over that (to account for rounding).
>
> genext2fs in effect works generating a file. Instead mkfs.btrfs seems to work only with disks (or file already created)...
Most mkfs tools require a file to already exist because they were
designed to create fixed size filesystem images.
>
>>
>> Overall, this could probably stand to be documented better though
>> (I'll look at writing a patch to update the documentation to clarify
>> this when I have some spare time over the weekend).
>
> This would be great. However I think that some code should be update in order to generate a file instead of rely on a block device.
>
> BR
> G.Baroncelli
>
next prev parent reply other threads:[~2017-09-01 11:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 17:27 [btrfs-progs] Bug in mkfs.btrfs -r Goffredo Baroncelli
2017-08-31 18:49 ` Austin S. Hemmelgarn
2017-08-31 20:29 ` Goffredo Baroncelli
2017-09-01 11:49 ` Austin S. Hemmelgarn [this message]
2017-09-01 0:13 ` Qu Wenruo
2017-09-01 11:28 ` Austin S. Hemmelgarn
2017-09-01 11:49 ` Qu Wenruo
2017-09-01 12:05 ` Austin S. Hemmelgarn
2017-09-01 12:19 ` Qu Wenruo
2017-09-01 12:47 ` Austin S. Hemmelgarn
2017-09-01 13:54 ` Qu Wenruo
2017-09-01 14:07 ` Austin S. Hemmelgarn
2017-09-02 4:03 ` Duncan
2017-09-05 3:57 ` Duncan
2017-09-01 11:54 ` Qu Wenruo
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=67a445ef-ce53-534a-8473-a5057b64d0fa@gmail.com \
--to=ahferroin7@gmail.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@vger.kernel.org \
/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).