使用“rsync”复制分区时,大小会有所不同。我应该担心吗?

使用“rsync”复制分区时,大小会有所不同。我应该担心吗?

我一直使用rsyncParted Magic CD 将我的 Ubuntu 14.04LTS 分区复制到 USB 驱动器作为备份。完成后,目标 USB 驱动器上的大小比源 SSHD 驱动器大 (>2.1GB)。我应该担心吗?为什么?

root@PartedMagic:~# df  
Filesystem     1K-blocks     Used Available Use% Mounted on  
/dev/sdb1      122940824 97847408  18825340  84% /media/sdb1  
/dev/sda3      239541408 95747516 131602840  43% /media/sda3  

这是我目前在 ROXTerm AP 中使用的脚本:

mount /dev/sdb1
mount /dev/sda3
cd /media/sda3
rsync -avpHAX --del --numeric-ids . /media/sdb1/

以下是相关fdisk -l信息:

root@PartedMagic:/media/sda3# fdisk -l  
Disk /dev/ram0: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram1: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram2: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram3: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram4: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram5: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram6: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram7: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram8: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram9: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram10: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram11: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram12: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram13: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram14: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk /dev/ram15: 16 MiB, 16777216 bytes, 32768 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disklabel type: dos  
Disk identifier: 0x5bc53d8b  
Device     Boot      Start        End   Sectors   Size Id Type  
/dev/sda1  *            63  955604991 955604929 455.7G  7 HPFS/NTFS/exFAT  
/dev/sda2        955604992  976766975  21161984  10.1G  7 HPFS/NTFS/exFAT  
/dev/sda3        976766976 1463753951 486986976 232.2G 83 Linux  
/dev/sda4       1463754750 1953523711 489768962 233.6G  5 Extended  
/dev/sda5       1463754752 1572020223 108265472  51.6G 83 Linux  
/dev/sda6       1572022272 1936746495 364724224 173.9G 83 Linux   
/dev/sda7       1936748544 1953523711  16775168     8G 82 Linux swap  
Partition 1 does not start on physical sector boundary.  
Partition 4 does not start on physical sector boundary.  
Disk /dev/sdb: 119.2 GiB, 128035323904 bytes, 250068992 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: dos  
Disk identifier: 0xd25c4889  
Device     Boot Start       End   Sectors   Size Id Type  
/dev/sdb1  *       63 250067789 250067727 119.2G 83 Linux

答案1

这没什么好担心的。它这样做的原因有几个。第一个是分区表中的系统信息。复制分区时,您只会将用户文件复制到新分区中,而旧分区中的所有临时文件都保持不变。另一个因素是十进制内存单元的长期问题。这在 USB 记忆棒和 HDD 中也是可以识别的(有没有注意到它们的内存比包装上说的要少?这是由于十进制的内存计算)。另一个问题可能只是用户错误。如果您没有目录的权限,或者其他原因阻止您复制它,则文件将不会镜像到新分区。希望这能有所帮助。

答案2

感谢大家的回复。他们帮助我缩小了问题的范围和原因。我最近发现影响这个问题的一个事实是源分区是扩展分区,而目标分区是主分区。一旦我将目标分区更改为扩展分区,数字几乎相同。因此,1000 与 1024 与主分区与扩展分区有关。我怀疑现在的几个 xK 差异与坏扇区有关(diff-福音真相 - 仍然没有显示任何差异)。

这是df从 SSD 驱动器 ( ) 启动时连接 USB 驱动器和未连接 USB 驱动器 (/dev/sdb5) 的s。仅相差 8K。请注意两个 s 中目录/dev/sda6的分区名称。在我看来,这是一个视觉错误,应该向 Ubuntu 用户报告:/df

:~# df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             1008240        8   1008232   1% /dev
tmpfs             203808     1200    202608   1% /run
/dev/sdb5       32896880 12291920  18910868  40% /
none                   4        0         4   0% /sys/fs/cgroup
none                5120        0      5120   0% /run/lock
none             1019020    16400   1002620   2% /run/shm
none              102400       40    102360   1% /run/user
/dev/sdb1       16382888  3650412  11877240  24% /media/markk/Ubuntu 15.10
/dev/sdb2        1125376    26325   1099051   3% /media/markk/Boot
/dev/sda1         323580    58804    264776  19% /media/markk/SYSTEM
/dev/sda2       91773948 62945400  28828548  69% /media/markk/D345EB1A3E8C47E1
/dev/sda7       72539432  3274148  65557380   5% /media/markk/519c4876-b4b6-43e5-8876-1656394e69a9

:~# df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             1008240        8   1008232   1% /dev
tmpfs             203808     1180    202628   1% /run
/dev/sda6       32896880 12291912  18910876  40% /
none                   4        0         4   0% /sys/fs/cgroup
none                5120        0      5120   0% /run/lock
none             1019020    16368   1002652   2% /run/shm
none              102400       40    102360   1% /run/user
/dev/sda1         323580    58804    264776  19% /media/markk/SYSTEM
/dev/sda2       91773948 62945400  28828548  69% /media/markk/D345EB1A3E8C47E1
/dev/sda7       72539432  3274148  65557380   5% /media/markk/519c4876-b4b6-43e5-8876-1656394e69a9

对于那些希望备份到可启动 USB 驱动器的人,还有一点需要注意……我最初使用的rsync命令-avpHAX在第一次尝试填充 USB 驱动器时运行良好。当它开始引用“Parted Magic”CD 时,后续发送“增量更改”的尝试没有完成。不知道为什么,但我怀疑它正在跟踪某个/...目录的硬链接。我所遵循的示例有一个-avp选项,我添加了该HAX部分以尝试解决“已使用”K 计数问题。

我剩下要解决的唯一问题与“grub”进程有关,它抱怨找不到某个设备 ID。当我确认并忽略该问题时,一切启动正常。

相关内容