It's just a memorandum for myself. The referenced manual is below.
Adding Persistence to a Kali Linux "Live" USB Drive
Burn the Kali Linux Live Image to a USB memory in advance by referring to the following. Burn with Etcher for Windows or dd command for Linux.
Making a Kali Bootable USB Drive
This time, it was carried out with a 32GB USB memory. The effective capacity is 28.93 GiB.
┌─[root@parrot]─[/home/jangari]
└──╼ #fdisk -l
Disk /dev/sdb: 28.93 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB Flash Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xfb0b3988
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 5898239 5898176 2.8G 17 Hidden HPFS/NTFS
/dev/sdb2 5898240 5899711 1472 736K 1 FAT12
The starting position is as per the manual, starting right next to the ISO size of Live Image. The end position is 28gb with a margin from the disk size.
┌─[root@parrot]─[/home/jangari]
└──╼ #end=28gb
┌─[root@parrot]─[/home/jangari]
└──╼ #read start _ < <(du -bcm /home/jangari/Downloads/kali-linux-2020.2-live-amd64.iso | tail -1); echo $start
2882
If you try to partition with parted, it's not the most recent optimal starting point I get a warning that the alignment is out of alignment. It's sunny, so give a proper starting point Make a note and cancel it.
┌─[root@parrot]─[/home/jangari]
└──╼ #parted /dev/sdb mkpart primary $start $end
Warning: You requested a partition from 2882MB to 28.0GB (sectors 5628906..54687500).
The closest location we can manage is 3021MB to 28.0GB (sectors 5899712..54687500).
Is this still acceptable to you?
Yes/No? Yes
Warning: The resulting partition is not properly aligned for best performance:
5899712s % 2048s != 0s
Ignore/Cancel? Cancel
┌─[✗]─[root@parrot]─[/home/jangari]
└──╼ #
Specify the start point again and cut the partition.
┌─[root@parrot]─[/home/jangari]
└──╼ #parted /dev/sdb mkpart primary 3021MB $end
Information: You may need to update /etc/fstab.
┌─[root@parrot]─[/home/jangari]
└──╼ #fdisk -l
Disk /dev/sdb: 28.93 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB Flash Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xfb0b3988
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 5898239 5898176 2.8G 17 Hidden HPFS/NTFS
/dev/sdb2 5898240 5899711 1472 736K 1 FAT12
/dev/sdb3 5900288 54687743 48787456 23.3G 83 Linux
This time I made ext4 with mkfs.ext4. The label should be persistence.
┌─[root@parrot]─[/home/jangari]
└──╼ #mkfs.ext4 -L persistence /dev/sdb3
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 6098432 4k blocks and 1525920 inodes
Filesystem UUID: 181ecc87-e2fd-4c2d-8feb-d2ee3655d23c
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Make a mount point and check if it can be mounted.
┌─[root@parrot]─[/home/jangari]
└──╼ #mkdir /mnt/my_usb
┌─[root@parrot]─[/home/jangari]
└──╼ #mount /dev/sdb3 /mnt/my_usb
┌─[root@parrot]─[/home/jangari]
└──╼ #mount | grep /dev/sdb3
/dev/sdb3 on /mnt/my_usb type ext4 (rw,relatime)
Create persistence.conf.
┌─[root@parrot]─[/home/jangari]
└──╼ #echo "/ union" > /mnt/my_usb/persistence.conf
┌─[root@parrot]─[/home/jangari]
└──╼ #ls -l /mnt/my_usb/persistence.conf
-rw-r--r-- 1 root root 8 Jun 8 16:20 /mnt/my_usb/persistence.conf
Unmount when finished.
┌─[root@parrot]─[/home/jangari]
└──╼ #umount /mnt/my_usb
┌─[root@parrot]─[/home/jangari]
└──╼ #mount | grep /dev/sdb3
┌─[✗]─[root@parrot]─[/home/jangari]
└──╼ #
end!
Recommended Posts