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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html