[TriLUG] using parted to change the size of a loop mounted filesystem
Steve Litt
slitt at troubleshooters.com
Thu Mar 15 00:52:22 EDT 2012
On Wed, 14 Mar 2012 23:03:13 -0400
Robert Dale <robdale at gmail.com> wrote:
> However, you don't need parted to do it! You can resize a file with
> dd and grow/shrink the fs accordingly.
>
> Let's try it...
>
> First create the file that will hold the filesystem...
> # dd if=/dev/zero of=foo.part bs=1M count=100
> 100+0 records in
> 100+0 records out
> 104857600 bytes (105 MB) copied, 0.742415 s, 141 MB/s
The preceding can be extremely slow when dealing with big files, like a
25GB file designed to hold the UDF filesystem for a blu-ray.
Fortunately, the truncate command is much, much faster:
truncate -s 25GB mybluray.udf
The preceding creates a sparse file, but it formats up perfectly when
you use mkudffs, or I presume mkfs.ext3.
For a 25GB file, the truncate command is probably hundreds of times
faster than doing it with dd.
HTH
SteveT
More information about the TriLUG
mailing list