How can I ban the use of swap partitions? (Solved)

Booting, installing, newbie
Post Reply
Message
Author
wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

How can I ban the use of swap partitions? (Solved)

#1 Post by wawi »

Hello,

I use Xenialpup64 for only one script: Hard disk cloning and the following comparison.

Now I have comparison errors and I suspect Xenialpup64 uses the swap partition of the hard drives that are being cloned.

How can I ban the use of swap partitions?
Last edited by wawi on Sun 06 May 2018, 17:57, edited 1 time in total.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Do I understand you correctly, the original hard drive that you're cloning has a swap partition on it? Or do you suspect that Xenialpup64 is creating a swap partition on its own initiative?

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#3 Post by wawi »

Flash wrote:Do I understand you correctly, the original hard drive that you're cloning has a swap partition on it?
Yes. And after using, both hard drives are not identical any more.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#4 Post by Flash »

So you cloned the hard drive including the swap partition? If you use the cloned hard drive and its swap partition is mounted, the contents of the swap partition might be changed somehow. That would be normal and expected.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#5 Post by wawi »

Flash wrote:So you cloned the hard drive including the swap partition? If you use the cloned hard drive and its swap partition is mounted, the contents of the swap partition might be changed somehow. That would be normal and expected.
I do not use the cloned disks intentionally, but use a separate system (Puppy) for cloning. Yes, the swap partition is also cloned to keep it simple. But Puppy loads all swap partitions and probably uses them. The following lines regarding installed hard drives that I can read at boot of Puppy:

Code: Select all

Loading swap partition /dev/sda1 (7.6G)...
Loading swap partition /dev/sdb1 (7.6G)...
Loading swap partition /dev/sdc1 (7.6G)...
It's usually a good idea to use the existing swap partitions. But not in my case. How can I block it?

User avatar
ally
Posts: 1957
Joined: Sat 19 May 2012, 19:29
Location: lincoln, uk
Contact:

#6 Post by ally »

google swapoff

:)

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#7 Post by HerrBert »

on slacko i do

Code: Select all

swapoff -a
to 'unload' swapfile, where the -a unloads all swaps

Code: Select all

# swapoff --help

Usage:
 swapoff [options] [<spec>]

Options:
 -a, --all              disable all swaps from /proc/swaps
 -h, --help             display help and exit
 -v, --verbose          verbose mode
 -V, --version          display version and exit

The <spec> parameter:
 -L <label>             LABEL of device to be used
 -U <uuid>              UUID of device to be used
 LABEL=<label>          LABEL of device to be used
 UUID=<uuid>            UUID of device to be used
 <device>               name of device to be used
 <file>                 name of file to be used

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#8 Post by wawi »

ally wrote:google swapoff
Thank you. Probably the solution. I will test it.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#9 Post by wawi »

ally wrote:google swapoff
Still comparison error!

Could be another reason. I have tested with other hard drives and other ports with md5sum. md5sum is stable, but not identical in source and destination disks.

I have used Puppy in an older version for years without any problems, until the USB stick was broken. I loaded the current Puppy and my Legacy script onto a new USB stick. Maybe someone can find the reason:

Code: Select all

#! /bin/bash -e
tail -n +4 $0  > /tmp/script.txt
exec rxvt -e bash /tmp/script.txt

swapoff -a

quelle=/dev/sdb
ziel=/dev/sdc
historyint=/dev/sda
log="/mnt/home/0Backup.Log"
sound="beep -f 400 -n -f 600 -n -f 800 -n -f 400 -n -f 600 -n -f 800"

/sbin/hdparm -B 128 -S 60 $historyint

echo -n "Beenden: e   andere Platten: a   sonst Anschlusstest Quelle $quelle "
read i
case "$i" in
 e) exit;;
 a) echo -n "Quelle: "; read quelle
    echo -n "Ziel:   "; read ziel
    echo -n "Anschlusstest Quelle $quelle mit ENTER "
    read ;;
esac

error=0
dd  if=$quelle of=/dev/null count=100000 || error=1
echo -n "Anschlusstest Ziel $ziel mit ENTER "
read
dd  if=$ziel of=/dev/null count=100000 || error=1

if [ "$error" = 0 ]; then
 echo -n "Wenn richtige Festplatten: Kopieren mit ENTER oder Abbruch Ctrl c "
 read
else
 echo -n "Beenden mit ENTER "
 read
 exit
fi

echo $(date -I;date +%T)" Festplatten werden jetzt kopiert" | tee -a $log
nice -n 19 ionice -c 3 dd if=$quelle of=$ziel bs=4096 2>&1  | tee -a $log

echo $(date -I;date +%T)" Festplatten werden jetzt verglichen" | tee -a $log

 nice -n 19 ionice -c 3 cmp     $quelle $ziel 2>&1 | tee -a $log
echo $(date -I;date +%T) | tee -a $log
echo "" | tee -a $log

echo "Fertig. Ctrl C, sonst Shutdown in 2 min."
$sound
sleep 60

echo "                            noch  1 min."
$sound
sleep 60

wmpoweroff

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#10 Post by Flash »

Wait a minute. You're comparing the entire contents of one hard disk drive with those of another, possibly larger or smaller drive? What makes you think the swap partition has anything to do with the md5sum difference? If the two drives are not exactly the same, I would expect a difference in their md5sums.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#11 Post by wawi »

Flash wrote:Wait a minute. You're comparing the entire contents of one hard disk drive with those of another, possibly larger or smaller drive? What makes you think the swap partition has anything to do with the md5sum difference? If the two drives are not exactly the same, I would expect a difference in their md5sums.
Comparing the raw hard drives can only work with exact the same numbers of bytes in the two hard drives. It is given.

Writing of one hard drive in the time of copying or comparing, for example on swap, will make a difference between source and destination.

Repeated tests with md5sum shold test the hardware. Seems to be stable.

The same script woked fine with an older Puppy version over years!

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#12 Post by wawi »

In the meantime I tested a lot. Results:
  • The difference between source and destination hard drives results from reading the destination drive. (Evidence: First error reading, second correct reading without new writing.)
  • While the error occurs, there is no report in /var/log/messages
Any ideas?

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#13 Post by rufwoof »

The action of mounting itself might write to the disk. This can happen even with read-only mounts for journaled filesystems such as ext3, ext4 (ntfs ???). If the filesystem was not cleanly unmounted the action of mounting the filesystem may replay the journal and perform the queued actions.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#14 Post by wawi »

In this case, the second reading would not be correct.

Would a temporary hardware error in the SATA port create a log entry?

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

How can I ban the use of swap partitions? (Solved)

#15 Post by wawi »

The reason for the problem was just a broken RAM. I had to think about it earlier.

Post Reply