About /mnt/rd/swap.img

Ir abajo

About /mnt/rd/swap.img

Mensaje  evr el Dom Ene 30, 2011 1:54 pm

Hi,
I am trying to understand the function of the flash swap /mnt/rd/swap.img. But, to start with, I am puzzled about the infos I get aout it:

1. From etc/rcS:
Código:
PC#> head -12 rcS-orig | tail -3
dd if=/Test.fat of=/dev/rd/0
mount -t vfat /dev/rd/0 /mnt/rd
swapon /mnt/rd/swap.img
2. Some facts:
Código:
lg#> du -sh /Test.fat
60.0k  /Test.fat
#
lg#> du -sh /mnt/rd/swap.img
40.0k  /mnt/rd/swap.img
#
df -h /mnt/rd/swap.img | tail -1
/dev/rd/0                40.0k    40.0k        0 100% /mnt/rd
#
lg#> grep swap.img /proc/swaps
/mnt/rd/swap.img                        file            32      0      -1
3. What is /Test.fat?:
Código:
file tmp/PC#> Test.fat
tmp/Test.fat: x86 boot sector, mkdosfs boot message display
#
PC#> hd tmp/Test.fat | head -13 | cut -c 61-78
|ë<.mkdosfs......|
|...<.ø.. .@.....|
|......)¨UîE    |
|      FAT12  ..|
|¾[|¬"Àt.V´.»..Í.|
|^ëð2äÍ.Í.ëþThis |
|is not a bootabl|
|e disk.  Please |
|insert a bootabl|
|e floppy and..pr|
|ess any key to t|
|ry again ... ...|
|................|
Now the puzzles:

a) Fom 1: Why the three steps: 1- copy ("dd") Test.img to a "disk partition" (/dev/rd/0), 2- mount this partition as a regular filesystem ("mount -t vfat ..."), 3- activate a file (swap.img) of the mounted partition as swap? ... I'd rather expect just doing "swapon /Test.img" (assuming Test.img were a swap file) in a single step. Any idea?

b) From 1 and 2: what happens with the sizes? From the initial 60.0k of Test.img after "dd" (which is just like "cp") and mount, it goes down to 40.0k; then after swapon, it is further shrank to 32k !!??!! -- Any explanation?

c) From 3: Test.fat seems to be just a boot message. Moreover, how is it converted into a swap partition? -- To make a swap area I'd rather expect mkswap, *not* "dd"... If this is not really a swap area it is not unexpected that swapping into this area makes trouble...

d) If the primary swap is *not* formated as swap, how is that swapon doesn't complain?

Waiting for enlightenment ;)
Regards,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Ver perfil de usuario

Volver arriba Ir abajo

Re: About /mnt/rd/swap.img

Mensaje  evr el Dom Ene 30, 2011 11:27 pm

evr escribió:I am trying to understand the function of the flash swap /mnt/rd/swap.img. But, to start with, I am puzzled about the infos I get about it: [...]
I answer to myself with explanation of some of the puzzles:
b) From 1 and 2: what happens with the sizes? From the initial 60.0k of Test.img after "dd" (which is just like "cp") and mount, it goes down to 40.0k; then after swapon, it is further shrank to 32k [...]
Yea!... Test.img is an msdos image of a directory which contain the file swap.img. So the sizes 60.0k and 40.0k are O.K. The shrink from 40k to 32k when activating this file as swap may also be O.K. (I don't know the details of activating a file --rather than a partition-- for swapping...).

The puzzle a) still goes unexplained. I've tried to copy swap.img to /tmp/swap.img /the hard disk) and then activate it directly as the first swap (after deactivating /mnt/rd/swap.img). But then, attempting to play video hangs DvdPlayer, as it happened in the case of no swap at all.

To be continued...
Best,

evr

Mensajes : 279
Fecha de inscripción : 12/10/2010

Ver perfil de usuario

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.