Outils pour utilisateurs

Outils du site


blog

Telnet vieux Unix console delete backspace

Pour faire backspace

[CTRL] + [H]

Ou pour avoir un terminal “normal”

bash
2025/03/24 15:06

Taille fichiers sur disque du ls sparse

Voir : https://wiki.archlinux.org/index.php/Sparse_file

Sparse, fichiers à trous

Voir du dh “ls -s” fallocate truncate

Notes :

du -sh /var/lib/libvirt/images/dic01-disk0
2,0G    /var/lib/libvirt/images/dic01-disk0

ls -lh /var/lib/libvirt/images/dic01-disk0
-rw-r--r-- 1 qemu qemu 120G 20 juin  14:53 /var/lib/libvirt/images/dic01-disk0
$ ls -lsh
total 22G
 16K drwx------ 2 root root  16K août   9 10:42 lost+found
7,7G -rw-r--r-- 1 jibe jibe 120G août   9 11:18 VM152-SUPPMSM-V-clone.img
 14G -rw-r--r-- 1 jibe jibe  14G févr. 24 09:15 VM152-SUPPMSM-V-clone.qcow2
$ du -h VM152-SUPPMSM-V-clone.*
7,7G    VM152-SUPPMSM-V-clone.img
14G     VM152-SUPPMSM-V-clone.qcow2

Unsparse

cp --sparse=never VM152-SUPPMSM-V-clone.raw VM152-SUPPMSM-V-clone_copy.raw

Ou

truncate -c -s $(( 1024 * 1024 + 1024 * $(ls -s VM152-SUPPMSM-V-clone.raw |awk '{print $1}') )) VM152-SUPPMSM-V-clone.raw
NOTES

Source : https://softwarebakery.com/shrinking-images-on-linux

fdisk -l myimage.img
Disk myimage.img: 6144 MB, 6144000000 bytes, 12000000 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
Disk identifier: 0x000ea37d

      Device Boot      Start         End      Blocks   Id  System
myimage.img1            2048     9181183     4589568    b  W95 FAT32

Note two things in the output:

  • The partition ends on block 9181183 (shown under End)
  • The block-size is 512 bytes (shown as sectors of 1 * 512)
truncate --size=$[(9181183+1)*512] myimage.img

Autres

rsync

rsync : Voir l'option --sparse

-S, --sparse                traite les fichiers à trous efficacement
cp

cp --sparse=always et --sparse=never

2025/03/24 15:06

Taille des bases MySQL/MariaDB

Source : https://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database

SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema;
2025/03/24 15:06

Système de fichier en lecture seule - read only filesystem

https://unix.stackexchange.com/questions/195010/remount-a-busy-disk-to-read-only-mode

echo u > /proc/sysrq-trigger
 
# paquet util-linux
fsfreeze -f /
fsfreeze -u /
 
echo 1 >/sys/block/dm-4/ro
echo 1 >/sys/block/sda/sda2/ro
# LANG=C fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sdb: Read-only file system

# hdparm -r0 /dev/sdb

/dev/sdb:
 setting readonly to 0 (off)
 readonly      =  0 (off)

Read only for one process

Autres

2025/03/24 15:06

Svn erreur svn cannot negotiate authentication mechanism

Erreur

$ svn checkout svn://hack.me:3600/Projets/Web/foo/trunk
svn: E210007: Unable to connect to a repository at URL 'svn://hack.me:3600/Projets/Web/foo/trunk'
svn: E210007: Impossible de négocier de mécanisme d'authentification

ou

$ svn info svn://hack.me:3600/Projets/Web/foo/trunk
svn: E170013: Unable to connect to a repository at URL 'svn://hack.me:3600/Projets/Web/foo/trunk'
svn: E210007: Cannot negotiate authentication mechanism

Solution

Sous Debian

sudo apt-get install libsasl2-modules

Sous RedHat7 / CentOS7

sudo yum install cyrus-sasl-md5
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki