3

I would like to use a live boot of Linux on an external SSD. First is this possible or should I use exclusively USB flash drives?

If the first answer is yes, I'd like to still use the SSD to store data or programs. Is this possible and how should I partition the disk and use Rufus in order to achieve this?

Of course I'd like to use the persistence of the data for the live boot.

Giacomo1968
  • 58,727

3 Answers3

2

You generally can use some versions of Linux from SSD as you state. Recently, I did as you wish to, using Ubuntu 24.04 LTS Desktop, following this procedure:

  • Download the Linux version and make a live installation USB using Rufus (or alternative). Ubuntu has a good installer for doing so, but I've not tried Kali.

  • Remove all partitions from the SSD, making it all empty space.

  • Remove or disable the internal SSD or HDD in the PC to prevent installation on that device. On the PC I used, it was easier to disable the SSD from BIOS than to physically remove it.

  • Insert both the Linux installation USB and the external SSD.

  • From UEFI/BIOS setup or from the boot order menu, choose the Linux installation USB.

  • After trying Linux from the USB drive, and confirming it works as expected, install it on the SSD. At that time, the installer will ask how much of the free space to use for Linux, and how much to leave.

  • At any time afterwards, select the free space in a Linux or in a Windows drive management utility, create a partition, and format it.

  • As to how to format the new partition, there are a number of choices:

    • ext4, BTRFS or other primarily-Linux file system. Windows can read data from those only with WSL or using third-party tool, such as DiskGenius. Writing to those file systems from Windows is both difficult and risky.
    • NTFS, a Microsoft file system that works well on Windows. Linux can read from NTFS with fuse, which may already be installed. On occasion, I've seen Windows complain after Linux writes to NTFS, though.
    • FAT32 or exFAT, both handles well by native Windows OS and by Linux with fuse. That said, these are not journaling file systems, as are the ones above, FAT32 has file size limitations, and my own use has shown FAT32 is slower, for unknown reasons.

The procedure of creating the bootable SSD and storage space took about an hour total, from the time I downloaded Ubuntu until Ubuntu installation was finished. At that point, I rebooted to the boot order menu, confirmed Ubuntu worked, and then reenabled the internal SSD.

That said, Kali has a very different philosophy, and does much less hand-holding, so your experience might be less successful.

Also, that SSD would work on the machine on which it's made. It might work on others, but there can be issues. For example, I maintain a PC with a Realtek RTL8831 WiFi device, which requires a driver be compiled into the kernel, and a generic SSD with Ubuntu would boot, but have no WiFi.

0

I would like to use a live boot of Linux on an external SSD. First is this possible or should I use exclusively USB flash drives?

Yes, this is possible. You can use an external SSD. Note that my answer assumes the USB SSD has a 512 byte sector size.

If the first answer is yes, I'd like to still use the SSD to store data or programs. Is this possible and how should I partition the disk and use Rufus in order to achieve this?

Yes, you can still use the SSD to store data or programs. This answer uses Rufus write the ISO file to the USB SSD. Any additional partitioning is done after booting to Kali live.

Note: I did try using Rufus to create the partition for persistence. While do so does seem to work, all the space on the SSD was allocated. There was no unallocated space left for any other partitions to be created. This answer avoids this problem.

Of course, I'd like to use the persistence of the data for the live boot.

Yes, you can use persistence of the data for the live boot. You can both UEFI and legacy BIOS boot Kali live.

Create a Kali Live USB SSD from Windows

Goto the kali website and download the live version. In this answer, the file kali-linux-2024.4-live-amd64.iso was downloaded.

Goto the Rufus website and download Rufus. In this answer, the file rufus-4.6p.exe.exe was downloaded.

Open the Rufus application. Make sure "List USB Hard Drives" is checked off. Select your USB SSD from the list of Devices. Click on the "Select" button and choose the Kali Live ISO file you downloaded. Your Rufus window should appear similar to the one shown below.

rufus

Select the "Start" button. In the popup shown below, select "Write in DD Image mode", then click on the "OK" button. In the next two popups, select the "OK" button.

Rufus popup

When Rufus is finished writing the image, close Rufus.

Adding Persistence to a Kali Linux Live USB Drive

In this section, a new ext4 partition will be created to store the persistent data. An NTFS formatted partition will also be added the USB drive. This section was adapted from this website.

Boot from the Kali Live USB SSD. From the menu shown below, select “Live system (amd64)”.

menu

The steps follow.

  1. Open a Terminal Emulator window. Enter the command below to become the root user.

    sudo -s
    

    Enter the command below to list block devices.

    lsblk
    

    Below the variable usb is set to the device label representing the USB SSD. Replace X with the appropriate letter. You can use the output from lsblk to determine this letter.

    usb=/dev/sdX
    

    Note: Here the assumption is made that the partitions /dev/sdX1 and /dev/sdX2 already exist. There should be no other partitions on dev/sdX.

  2. Create additional partitions in the empty space after the Kali Live partitions on the USB SSD.

    The command below creates a 9537 MiB (about 10 GB) third primary partition. The partition type defaults to 83 (Linux).

    fdisk $usb <<< $'n\np\n\n\n+9537m\nw'
    

    The command below creates a 9537 MiB (about 10 GB) forth primary partition. The partition type is set to 07 (NTFS).

    fdisk $usb <<< $'n\np\n\n\nt\n\n7\nw'
    

    The command below can be used to print the partition table.

    fdisk -l $usb
    
  3. Create a file systems in both new partitions.

    Enter the command below to create an ext4 file system in the third primary partition and label it persistence.

    mkfs.ext4 -L persistence ${usb}3
    

    Enter the command below to create an NTFS file system in the forth primary partition and label it MyNTFS.

    mkfs.ntfs -f -L MyNTFS ${usb}4
    
  4. Mount the new ext4 partition, then create the configuration file to enable persistence. Finally, unmount the partition and exit from being the root user. The commands are given below.

    mount ${usb}3 /mnt
    echo "/ union" > /mnt/persistence.conf
    umount /mnt
    exit
    

You can now reboot into “Live USB Persistence”. Keep in mind you will need to select this boot option every time you wish to have your work stored.


Example from Kali Terminal Emulator Window

┌──(kali㉿kali)-[~]
└─$ sudo -s
┌──(root㉿kali)-[/home/kali]
└─# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0     4G  1 loop /usr/lib/live/mount/rootfs/filesystem.squashfs
                                 /run/live/rootfs/filesystem.squashfs
sda      8:0    0 453.4G  0 disk 
sdb      8:16   0 233.5G  0 disk 
├─sdb1   8:17   0   4.7G  0 part /usr/lib/live/mount/medium
│                                /run/live/medium
└─sdb2   8:18   0     4M  0 part 
sr0     11:0    1  1024M  0 rom

┌──(root㉿kali)-[/home/kali] └─# usb=/dev/sdb

┌──(root㉿kali)-[/home/kali] └─# fdisk $usb <<< $'n\np\n\n\n+9537m\nw'

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

This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.

The device contains 'iso9660' signature and it may remain on the device. It is recommended to wipe the device with wipefs(8) or fdisk --wipe, in order to avoid possible collisions.

Command (m for help): Partition type p primary (2 primary, 0 extended, 2 free) e extended (container for logical partitions) Select (default p): Partition number (3,4, default 3): First sector (9846020-489619455, default 9846784): Last sector, +/-sectors or +/-size{K,M,G,T,P} (9846784-489619455, default 489619455): Created a new partition 3 of type 'Linux' and of size 9.3 GiB.

Command (m for help): The partition table has been altered. Syncing disks.

┌──(root㉿kali)-[/home/kali] └─# fdisk $usb <<< $'n\np\n\n\nt\n\n7\nw'

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

This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.

The device contains 'iso9660' signature and it may remain on the device. It is recommended to wipe the device with wipefs(8) or fdisk --wipe, in order to avoid possible collisions.

Command (m for help): Partition type p primary (3 primary, 0 extended, 1 free) e extended (container for logical partitions) Select (default e): Selected partition 4 First sector (9846020-489619455, default 29378560): Last sector, +/-sectors or +/-size{K,M,G,T,P} (29378560-489619455, default 489619455): Created a new partition 4 of type 'Linux' and of size 219.5 GiB.

Command (m for help): Partition number (1-4, default 4): Hex code or alias (type L to list all): Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.

Command (m for help): The partition table has been altered. Syncing disks.

┌──(root㉿kali)-[/home/kali] └─# fdisk -l $usb
Disk /dev/sdb: 233.47 GiB, 250685161472 bytes, 489619456 sectors Disk model: HARDDISK
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: 0xa8d8652c

Device Boot Start End Sectors Size Id Type /dev/sdb1 * 64 9837827 9837764 4.7G 17 Hidden HPFS/NTFS /dev/sdb2 9837828 9846019 8192 4M 1 FAT12 /dev/sdb3 9846784 29378559 19531776 9.3G 83 Linux /dev/sdb4 29378560 489619455 460240896 219.5G 7 HPFS/NTFS/exFAT

┌──(root㉿kali)-[/home/kali] └─# mkfs.ext4 -L persistence ${usb}3 mke2fs 1.47.1 (20-May-2024) Creating filesystem with 2441472 4k blocks and 610800 inodes Filesystem UUID: 82bd1733-dd23-4208-a2ac-ccae989076d0 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

┌──(root㉿kali)-[/home/kali] └─# mkfs.ntfs -f -L MyNTFS ${usb}4
Cluster size has been automatically set to 4096 bytes. Creating NTFS volume structures. mkntfs completed successfully. Have a nice day.

┌──(root㉿kali)-[/home/kali] └─# mount ${usb}3 /mnt

┌──(root㉿kali)-[/home/kali] └─# echo "/ union" > /mnt/persistence.conf

┌──(root㉿kali)-[/home/kali] └─# umount /mnt

┌──(root㉿kali)-[/home/kali] └─# exit

┌──(kali㉿kali)-[~] └─$

0

Short answer, yes. All you need to do is resize the rest of the USB/SD card in the terminal. I believe the default size on it will be 15mb.