7

I've been trying to save my "/" without success for the past hours :(

I'm on a testing branch of Debian, I'd like to save my system every time before updating. The backup would go on the second drive which is a bootable Win7.

sudo rsync -aAXv --inplace --info=progress2 --no-whole-file --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/*} / "/media/sessionR/Disque Dur 1/System_save_sauvegarde_25.03.2017/" > save.txt 

The same command below (not sure about best readability)

sudo rsync -aAXv --inplace --info=progress2 --no-whole-file --exclude={"/dev/\*","/proc/\*","/sys/\*","/tmp/\*","/run/\*","/mnt/\*","/media/\*","/lost+found","/home/\*} / "/media/sessionR/Disque Dur 1/System_save_sauvegarde_25.03.2017/" > save.txt 
  • Source "/" is on my internal laptop sata hard drive.

  • Destination "/media/sessionR/Disque Dur 1/System_save_sauvegarde_25.03.2017/" is the mount point for "/dev/sdb2" which is a second internal sata hard drive replacing the DVD drive.

After some files get copied, tons of files come up with error: No space left on device (28) :

rsync: recv_generator: mkdir "/media/sessionR/Disque Dur 1/System_save_sauvegarde_25.03.2017/var/tmp" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***

And the end result below is like 2Gb instead of the ±11Gb announced by the dry run:

sent 2,554,663,982 bytes  received 1,188,942 bytes  17,446,095.04 bytes/sec
total size is 11,825,525,653  speedup is 4.63
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

I don't get it; I have ample space:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           376M   21M  356M   6% /run
/dev/sda1        18G   12G  5.3G  69% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda5       2.7G 1008M  1.6G  39% /var
/dev/sda8       120G   91G   24G  80% /home
/dev/sda7       360M   32M  306M  10% /tmp
tmpfs           376M   24K  376M   1% /run/user/1000
/dev/sdb2       287G  240G   47G  84% /media/sessionR/Disque Dur 1

Could it be something about the filesystem ? (Hidden NTFS WinRE+ HPFS/NTFS/exFAT)

findmnt /dev/sdb2

TARGET SOURCE FSTYPE OPTIONS

/media/sessionR/Disque Dur 1 /dev/sdb2 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permis‌​sions,allow_other,bl‌​ksize=4096

sudo fdisk -l
[sudo] password for sessionR: 
Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 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: 0x5def152b

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1  *        2048  38057983  38055936  18.2G 83 Linux
/dev/sda2       38057984 312581807 274523824 130.9G  5 Extended
/dev/sda5       38060032  43917311   5857280   2.8G 83 Linux
/dev/sda6       43919360  56475647  12556288     6G 82 Linux swap / Solaris
/dev/sda7       56477696  57255935    778240   380M 83 Linux
/dev/sda8       57257984 312580095 255322112 121.8G 83 Linux


Disk /dev/sdb: 298.1 GiB, 320072933376 bytes, 625142448 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: 0xf571c4f5

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sdb1             63  25173854  25173792    12G 27 Hidden NTFS WinRE
/dev/sdb2  *    25174016 625139703 599965688 286.1G  7 HPFS/NTFS/exFAT

Apparently it's not inodes:

df -ih
Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             467K   471  466K    1% /dev
tmpfs            470K   772  469K    1% /run
/dev/sda1        1.2M  441K  712K   39% /
tmpfs            470K     1  470K    1% /dev/shm
tmpfs            470K     6  470K    1% /run/lock
tmpfs            470K    15  470K    1% /sys/fs/cgroup
/dev/sda5        179K   17K  162K   10% /var
/dev/sda7         96K    26   96K    1% /tmp
/dev/sda8        7.7M   50K  7.6M    1% /home
tmpfs            470K    21  470K    1% /run/user/1000
/dev/sdb2         47M  271K   47M    1% /media/sessionR/Disque Dur 1

What would you do?

Still no luck. In fact I can't copy anything any more on the second disk (destination), it will always say it's full.

Apparently the presence of filesystem files was what was wreaking havoc with copy/paste operations, which is a real problem as it's exactly what I'm trying to save!

  • 1
    Since you ask: I'd use dump / restore instead of rsync. – Satō Katsura Mar 28 '17 at 9:29
  • Never heard of dump / restore, I will look it it if I really can't figure rsync out. I guess it won't preserve permissions though ? That was my intended goal. I want to save my system every time before updating it so that I can restore in case of problems (I'm on the testing branch) – SessionR Mar 28 '17 at 9:49
  • 1
    @terdon I was under the impression that -a : Archive mode would preserve permissions. -a : The files are transferred in "archive" mode, which ensures that symbolic links, devices, attributes, permissions, ownerships etc are preserved in the transfer. I've read that one could use a .tar to preserve permissions on NTFS but I don't know if that's what -a does. – SessionR Mar 28 '17 at 12:03
  • 1
    I don't know much about this, but AFAIK, NTFS permissions are their own thing and getting them to play nice with Linux filesystems is possible but complex. Have a look here. The idea with tar is that the permissions are stored in the tarball and can be restored when you extract it on a filesystem that can do permissions. But I wouldn't expect this to work as you want with just an rsync. – terdon Mar 28 '17 at 12:16
  • 1
    So... NTFS does support extended attributes, which means you can save owernships, permissions, etc. using -M--fake-super (and restore them with --fake-super -M--super). I think this answers @terdon's comment about permissions. – roaima Mar 28 '17 at 14:09
5

Your external disk has only 47G left. Your /home partition weighs 91G.

Today's Linux distributions offer encryption and it is not uncommon that there exist a hidden directory /home/.ecryptfs that actually holds all the files. Your excluding rule /home/* would not exclude that directory.

If you want to also exclude hidden directories, exclude the whole /home, not /home/*. BTW, think about the --one-file-system option, I find it error-prone to save / while excluding a long list of directories.

  • When the dry run announces sent 2,554,663,982 bytes received 1,188,942 bytes 17,446,095.04 bytes/sec total size is 11,825,525,653 isn't it saying that only 11Gb are going to be transferred? I don't use encryption and I tweaked the --exclude={... so that .cache shouldn't be there. I'll look into it. – SessionR Mar 28 '17 at 13:01
  • $HOME/.cache would be excluded already due to the --exclude=/home/* rule. I thought that the encryption directory lived under $HOME too, BIC(E)BW on that one as I use disk-level encryption myself. – roaima Mar 28 '17 at 13:01
  • @xhienne d'oh! Yes, of course it would. Never mind, I was being silly. – terdon Mar 28 '17 at 13:02
  • 1
    @SessionR Well, you seem to be right. There is 11 GB in total and, even it obsolete files are deleted at the end of the rsync process, there is enough space on your external disk. I'm clueless. NTFS quotas maybe? You should really really reformat your disk to ext4. – xhienne Mar 28 '17 at 13:07
  • @xhienne, -x is --one-file-system. I used a capital -X though so I'll just have to test with the regular -x. I don't think that's what's causing my issue but I'll test it. I should reformat yes, but that's a perfectly bootable win7 drive that I can dual boot to... – SessionR Mar 28 '17 at 13:09
3

Sometimes when I want to access only the root file-system, I use the trick:

mkdir /bind
mount -o bind / /bind
cd /bind

Now, I can see the root file-system without any sub-mounts. If I do a:

cp -a . /some/other/volume

or

rsync -tral . /some/other/volume/

Then it will not pick up any volumes mounted on my root file system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.