


Code: Select all
# time rsync -aHA --del --force --stats --progress /mnt/backup/gentoo/ /mnt/gentoo



I've read in the past that swap can be slightly smaller, not larger, than your RAM if you want Linux to be able to hibernate. The reason for this was stated as being because the contents of RAM are compressed when saved to disk.NeddySeagoon wrote:However, swap a little larger than your RAM is needed for hibernation, if thats important to you.

Anonymous (not verified) on June 23, 2008 - 5:10pm
Isn't swap necessary for Suspend To Disk/Hibernate? And if so, how much?
Anonymous (not verified) on June 24, 2008 - 5:45am
I think for suspend to disk you need a storage space an large as your ram.
Is that actually the case?Anonymous (not verified) on June 24, 2008 - 12:57pm
suspend-to-disk uses compressed images, so you can do with less swap than RAM (if it compresses well). It also only stores actual program images, so caches are likely to get evicted, the kernel is mostly unloaded, etc.
So it seems that making swap the same size as RAM is more than enough.Nigel Cunningham wrote:> * How the installer of a Linux distribution should decide on the size of
> the hibernation file/partition? Worst case seems to be the installed
> memory size + swap partition but given that LZO compresses the image
> well enough is it possible to assume a size for the image file based on
> some proportions or something else?
LZO compression almost always achieves greater than 50% compression, so
you should be able to fit all images in swapspace equal to half the
amount of memory you have. Of course you might want to add a margin for
normal swapping and variations in the compression that's achieved.

Code: Select all
# free -bt
total used free shared buffers cached
Mem: 4142669824 2399014912 1743654912 0 175312896 1153126400
-/+ buffers/cache: 1070575616 3072094208
Swap: 4293558272 0 4293558272
Total: 8436228096 2399014912 6037213184Code: Select all
$ cat /usr/src/linux/.config | grep LZO
CONFIG_HAVE_KERNEL_LZO=y
# CONFIG_KERNEL_LZO is not set <---- Kernel Compression Mode was selected to be LZMA rather than LZO
CONFIG_RD_LZO=y
CONFIG_JFFS2_LZO=y
# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
CONFIG_UBIFS_FS_LZO=y
CONFIG_SQUASHFS_LZO=y
CONFIG_CRYPTO_LZO=m
CONFIG_LZO_COMPRESS=m
CONFIG_LZO_DECOMPRESS=y
CONFIG_DECOMPRESS_LZO=yCode: Select all
Dec 29 12:01:06 meshedgedx kernel: [ 272.829994] TuxOnIce: Failed to initialise the lzo compression transform.
Dec 29 12:01:06 meshedgedx kernel: [ 272.829995] Failed to initialise compression algorithm.
Dec 29 12:01:06 meshedgedx kernel: [ 272.829996] Continuing without compressing the image.
.
.
.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908327] TuxOnIce debugging info:
Dec 29 12:01:06 meshedgedx kernel: [ 316.908330] - TuxOnIce core : 3.2-rc2
Dec 29 12:01:06 meshedgedx kernel: [ 316.908331] - Kernel Version : 2.6.36-sabayon
Dec 29 12:01:06 meshedgedx kernel: [ 316.908333] - Compiler vers. : 4.4
Dec 29 12:01:06 meshedgedx kernel: [ 316.908335] - Attempt number : 1
Dec 29 12:01:06 meshedgedx kernel: [ 316.908336] - Parameters : 32777 667648 0 0 0 5
Dec 29 12:01:06 meshedgedx kernel: [ 316.908338] - Overall expected compression percentage: 0.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908340] - Checksum method is 'md4'.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908344] 0 pages resaved in atomic copy.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908345] - Block I/O active.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908346] Used 0 pages from swap on /dev/sda5.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908347] - Max outstanding reads 1052. Max writes 20353.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908348] Memory_needed: 1024 x (4096 + 344 + 112) = 4661248 bytes.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908349] Free mem throttle point reached 0.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908350] - Swap Allocator enabled.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908351] Swap available for image: 1048232 pages.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908352] - File Allocator active.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908352] Storage available for image: 0 pages.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908353] - I/O speed: Write 54180 KB/s.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908354] - Extra pages : 5179 used/500.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908355] - Result : Hibernation was aborted.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908356] : Insufficient storage was available.
Dec 29 12:01:06 meshedgedx kernel: [ 316.908357] : I/O errors were encountered.Code: Select all
$ cat /usr/src/linux/.config | grep LZO
CONFIG_HAVE_KERNEL_LZO=y
# CONFIG_KERNEL_LZO is not set <---- I left Kernel Compression Mode as LZMA rather than LZO
CONFIG_RD_LZO=y
CONFIG_JFFS2_LZO=y
# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
CONFIG_UBIFS_FS_LZO=y
CONFIG_SQUASHFS_LZO=y
CONFIG_CRYPTO_LZO=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_DECOMPRESS_LZO=yCode: Select all
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711101] TuxOnIce debugging info:
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711102] - TuxOnIce core : 3.2-rc2
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711103] - Kernel Version : 2.6.36-sabayon
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711103] - Compiler vers. : 4.4
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711104] - Attempt number : 1
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711104] - Parameters : 0 667648 0 0 0 5
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711105] - Overall expected compression percentage: 0.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711105] - Checksum method is 'md4'.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711106] 0 pages resaved in atomic copy.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711107] - Compressor is 'lzo'.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711107] Compressed 2180071424 bytes into 914681193 (58 percent compression).
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711108] - Block I/O active.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711108] Used 225238 pages from swap on /dev/sda5.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711109] - Max outstanding reads 1338. Max writes 10377.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711110] Memory_needed: 1024 x (4096 + 344 + 112) = 4661248 bytes.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711110] Free mem throttle point reached 0.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711111] - Swap Allocator enabled.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711112] Swap available for image: 1048232 pages.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711112] - File Allocator active.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711113] Storage available for image: 0 pages.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711113] - I/O speed: Write 130 MB/s, Read 153 MB/s.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711114] - Extra pages : 5214 used/500.
Dec 29 15:22:45 meshedgedx kernel: [ 1205.711115] - Result : Succeeded.
Right, I'm finally getting round to doing this. Will your command copy everything thats under / ?d2_racing wrote:Hi, I use rsync all the time to backup or migrate my stuff.
I use this command :
Where /mnt/backup/gentoo is my old hdd and /mnt/gentoo is my new hdd.Code: Select all
# time rsync -aHA --del --force --stats --progress /mnt/backup/gentoo/ /mnt/gentoo
Clean and simple.

Also see:Fitzcarraldo wrote:Had a hunt for the post I remembered reading, and found it in KernelTrap: http://kerneltrap.org/node/16317#comment-303704
So it seems that making swap the same size as RAM is more than enough.
Note: On mine it actually seems to be set to "847683584" by default so I think the default might have changed or there is some other process at work which I am not aware of that sets it. My RAM is 2 GB and I have also created a 2 GB swap.50 /sys/power/image_size controls the size of the image created by
51 the suspend-to-disk mechanism. It can be written a string
52 representing a non-negative integer that will be used as an upper
53 limit of the image size, in bytes. The suspend-to-disk mechanism will
54 do its best to ensure the image size will not exceed that number. However,
55 if this turns out to be impossible, it will try to suspend anyway using the
56 smallest image possible. In particular, if "0" is written to this file, the
57 suspend image will be as small as possible.
58
59 Reading from this file will display the current image size limit, which
60 is set to 500 MB by default.
61
