Sparse files: Porovnání verzí
Skočit na navigaci
Skočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
Řádek 5: | Řádek 5: | ||
==Copy locally== |
==Copy locally== |
||
===cp=== |
|||
<source lang="bash">cp from to</source> |
<source lang="bash">cp from to</source> |
||
===dd=== |
|||
<source lang="bash">dd if=srcFile of=dstFile iflag=direct oflag=direct bs=64K conv=sparse</source> |
|||
==Show real size== |
==Show real size== |
Verze z 31. 8. 2022, 11:54
Create sparse file
truncate -s 10G ./file
Copy locally
cp
cp from to
dd
dd if=srcFile of=dstFile iflag=direct oflag=direct bs=64K conv=sparse
Show real size
ls
Show real size and logical file size:
ls -lhs file
du
Show real file size:
du -sh file
Copy over network
rsync
rsync -aS file user@host:/dir
Reclaim space on ext4 image
Mount old image as loopback device:
mount old.raw /mnt/old
Get size of the file:
ls -l old.raw
Create second sparse image file with the same size:
truncate -s <size> new.raw
Format it with ext4 file system:
mkfs.ext4 new.raw
Mount new image as loopback device:
mount new.raw /mnt/new
Synchronize entire disk:
rsync -aSAXv /mnt/old/ /mnt/new
Unmount disks:
umount /mnt/old
umount /mnt/new