I am trying to clone my Linux USB live persistence from a 32 GB drive to a 64 GB drive. After I clone it, there is some unallocated space (32 GB). I have done some research but I still cannot figure it out. Below are the things that I tried.

I booted from the old USB and used cfdisk to check the partition.  It said that there is unallocated free 32 GB on my new USB drive, so I used resize to resize /dev/sdb3 from 20 GB to 54.3 G as shown:

                              Disk: /dev/sdb
              Size: 57.3 GiB, 61505273856 bytes, 120127488 sectors
                       Label: dos, identifier: 0x0e390ebe

    Device      Boot     Start        End    Sectors   Size  Id Type
    /dev/sdb1   *           64    6279167    6279104     3G  17 Hidden HPFS/NTFS
    /dev/sdb2          6279168    6280575       1408   704K   1 FAT12
    /dev/sdb3          6281216  120127487  113846272  54.3G  83 Linux

When I use fdisk -l to check the partition, it tells me it has 54.3 GB in the partition.

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sdb1  *         64   6279167   6279104    3G 17 Hidden HPFS/NTFS
/dev/sdb2       6279168   6280575      1408  704K  1 FAT12
/dev/sdb3       6281216 120127487 113846272 54.3G 83 Linux

But when I use df -h it showed me that my /dev/sdb3 is still 26 GB:

Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           785M   11M  775M   2% /run
/dev/sdb1       3.0G  3.0G     0 100% /run/live/persistence/sdb1
/dev/loop0      2.8G  2.8G     0 100% /run/live/rootfs/filesystem.squashfs
tmpfs           3.9G     0  3.9G   0% /run/live/overlay
/dev/sdb3        26G   18G  6.9G  72% /run/live/persistence/sdb3
overlay          26G   18G  6.9G  72% /
tmpfs           3.9G   48M  3.8G   2% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G  324K  3.9G   1% /tmp
tmpfs           785M   48K  785M   1% /run/user/0
/dev/sdb2       684K  670K   14K  98% /media/root/Kali Live

I also tried using GParted, but it doesn't help:

GParted screen image showing /dev/sdb is 57.28 GiB

What can I do to extend the OS partition but not just the USB partition?

  • It looks like you increased the size of the partition, but not the file-system (that is in the partition). – ctrl-alt-delor Mar 16 '19 at 19:02
  • Please paste text as text (not as pictures), it is easier to read that way (not just for blind people). And Why kali? Kali is hard to use (much like a swiss army chain-saw). kali has one purpose, and this is not it. You say you are new to Gnu/Linux, therefore kali is not for you. Chose an easier distro such as Debian. – ctrl-alt-delor Mar 16 '19 at 19:02
  • @ctrl-alt-delor Thanks for your suggestions, I will improve next time! – Lau Chok Yip Mar 16 '19 at 19:10

It sounds like you extended/increased the size of the partition but did not notify the filesystem that there was more space for it to use.

xfs_growfs or xfs_admin with the right flags should let you inform the filesystem that it can grow to fill the additional space.

This sort of thing can be tricky on a liveOS booting from a USB. It is often easier to install the liveOS fresh on the new device and copy your data over.

  • how can I copy my data over to new device? By using dd? – Lau Chok Yip Mar 16 '19 at 19:20
  • @LauChokYip that is a different question. – ctrl-alt-delor Mar 17 '19 at 13:37

i would have just used parted to resize the partition, but you already did that.

The next step is to boot kali in regular mode [not persistence] in a terminal do this...

umount /dev/sdb3 

Actually run fdisk -l first and make sure sdb is the drive you want to change

e2fsck /dev/sdb3 

If there are any errors just type Y to fix 'em and finally

resize2fs /dev/sdb3

will maximize the filesystem to the size of sdb3's partition. Reboot into persistence mode and viola! sdb3 is now bigger. I know it works because I literally just did this cloning a 32GB kali usb2 over to a 64gb USB3 and then I used this method using the 64GB to do surgery on itself :D

As for your second question, just

sudo dd if=/dev/sdb of=/somewhereYouHavePremissionToWrite/kali.iso bs=1m conv=notrunc

and then dd again to your bigger drive using kali.iso for the input file and /dev/biggerDrive for the output file. You could dd disk to disk, but some serious bottle-necking would probably happen and if the write fails you still have kali.iso to try again with. Obviously these directions are out of order. you want to dd first, resize the partition and then resize the filesystem of said partition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.