The Zep Man schreef op woensdag 22 november 2023 @ 18:18:
[...]
Dan moet je potentieel exotische zaken doen om partities te vergroten. Dat is altijd wat riskant. Mijn methode:
1. Partitioneer en formatteer het nieuwe medium.
2. Mount het nieuwe medium in de gewenste doelstructuur, bijvoorbeeld onder /mnt.
3. Kopieer met rsync / naar /mnt, met enkele uitzonderingen (waaronder /mnt).
Ik voorzie meer problemen met zelf partitioneren en formatteren door gebruikers die niet zo bedreven zijn in deze stappen als dat je dit met de disk destroyer (
dd) zou doen.
Ik denk bv aan boot en lba vlaggetjes, UEFI, bytes per sector of
brtrfs /
zfs met hun volumes en snaps.
Dan lijkt het voor mij gemakkelijker dit te doen met
dd en achteraf
parted /
gparted los te laten om partities en FS grote aan te passen.
Ik doe het ook vaak met
dd +
gparted gewoon omdat je niet zoveel hoeft uit te zoeken eerst.
Maar dit is mijn mening!
Nog een tip als
je men besluit met
dd eerst een disk image te maken (of voor welke disk image dan ook):
$ sudo losetup -f
/dev/loop0
$ sudo losetup -P /dev/loop0 /mnt/nas_shared/linux/rasbian/armhf/2017-09-07-raspbian-stretch-lite/2017-09-07-raspbian-stretch-lite.img
$
$ sudo losetup -l
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop0
0 0 0 0 /mnt/nas_shared/Linux/Rasbian/armhf/2017-09-07-raspbian-stretch-lite/2017-09-07-raspbian-stretch-lite.img
$ lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
/dev/loop0 7:0 0 1.7G 0 loop
|-/dev/loop0p1 259:2 0 41.8M 0 part
`-/dev/loop0p2 259:3 0 1.7G 0 part
[..]
$ sudo mount -o ro /dev/loop0p2 /mnt/tmp/
$
$ ll /mnt/tmp/
total 96
drwxr-xr-x 21 root root 4096 Sep 7 2017 .
drwxr-xr-x 5 root root 4096 Nov 23 15:28 ..
drwxr-xr-x 2 root root 4096 Sep 7 2017 bin
drwxr-xr-x 2 root root 4096 Sep 7 2017 boot
drwxr-xr-x 4 root root 4096 Sep 7 2017 dev
drwxr-xr-x 83 root root 4096 Sep 7 2017 etc
drwxr-xr-x 3 root root 4096 Sep 7 2017 home
drwxr-xr-x 16 root root 4096 Sep 7 2017 lib
drwx------ 2 root root 16384 Sep 7 2017 lost+found
drwxr-xr-x 2 root root 4096 Sep 7 2017 media
drwxr-xr-x 2 root root 4096 Sep 7 2017 mnt
drwxr-xr-x 3 root root 4096 Sep 7 2017 opt
drwxr-xr-x 2 root root 4096 Jul 28 2017 proc
drwx------ 2 root root 4096 Sep 7 2017 root
drwxr-xr-x 5 root root 4096 Sep 7 2017 run
drwxr-xr-x 2 root root 4096 Sep 7 2017 sbin
drwxr-xr-x 2 root root 4096 Sep 7 2017 srv
drwxr-xr-x 2 root root 4096 Jul 28 2017 sys
drwxrwxrwt 2 root root 4096 Sep 7 2017 tmp
drwxr-xr-x 10 root root 4096 Sep 7 2017 usr
drwxr-xr-x 11 root root 4096 Sep 7 2017 var
Ik gebruik de oude
raspbian-stretch-lite image boven als voorbeeld omdat deze toevalig was uitgepakt/unzipped op m'n NAS.
En
losetup zit in de
mount package die meestal al is geinstalleerd:
$ dpkg -S /sbin/losetup
mount: /sbin/losetup
EDIT: Ter info:
$ man losetup
[..]
DESCRIPTION
losetup is used to associate loop devices with regular files or block
devices, to detach loop devices, and to query the status of a loop
device.
[..]
-f, --find [file]
Find the first unused loop device. If a file argument is present,
use the found device as loop device. Otherwise, just print its
name.
[..]
-P, --partscan
Force the kernel to scan the partition table on a newly created
loop device. Note that the partition table parsing depends on
sector sizes. The default is sector size is 512 bytes, otherwise
you need to use the option --sector-size together with --partscan.
[..]
-l, --list
If a loop device or the -a option is specified, print the default
columns for either the specified loop device or all loop devices;
the default is to print info about all devices. See also --output,
--noheadings, --raw, and --json.
[
Voor 18% gewijzigd door
deHakkelaar op 23-11-2023 16:14
]
There are only 10 types of people in the world: those who understand binary, and those who don't