0

I have Kali linux installed with dd on a couple of drives, they all have live persistence enabled with one acting as LUKS encrypted one (sdb3) (the one I'm using) and the other one is without encryption (sdb4).

I want to expand sdb3 while shrinking sdb4

$ fdisk -l
Disk /dev/sdb: 14.5 GiB, 15518924800 bytes, 30310400 sectors
Disk /dev/sdb: 14.5 GiB, 15518924800 bytes, 30310400 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
Disklabel type: dos
Disk identifier: 0xf73f6410

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdb1  *          64  5913631  5913568  2.8G 17 Hidden HPFS/NTFS
/dev/sdb2        5913632  5915039     1408  704K  1 FAT12
/dev /sdb3        5915040 17578125 11663086  5.6G 83 Linux
/dev/sdb4       17578126 28320312 10742187  5.1G 83 Linux


Disk /dev/loop0: 2.6 GiB, 2775728128 bytes, 5421344 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`

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: 0xf73f6410

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdb1  *          64  5913631  5913568  2.8G 17 Hidden HPFS/NTFS
/dev/sdb2        5913632  5915039     1408  704K  1 FAT12
/dev/sdb3        5915040 17578125 11663086  5.6G 83 Linux
/dev/sdb4       17578126 28320312 10742187  5.1G 83 Linux


Disk /dev/loop0: 2.6 GiB, 2775728128 bytes, 5421344 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`

NOTE: I DON'T THINK THIS ONE ABOVE HAS ANYTHING TO DO WITH THE PROBLEM

Disk /dev/mapper/sdb3: 5.6 GiB, 5969402880 bytes, 11658990 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

So sdb3 = LUKS encrypted partition live persistence and sdb4 = non encrypted live persistence.

As I'm not using sdb4 I want to shrink it and expand sdb3, but I know if I change the Sectors starting points and End the OS may be confused and wont be able to boot properly as I've done it before.

I've proceed with the following steps unsuccessfully:

$ umount /dev/sdb3

$ fdisk -l

(with this tool I delete the 2 last partitions and I proceed changing sector starting points for both sdb3 and sdb4).

$ e2fsck -f /dev/sdb3

Yes to everything and F

$ resize2fs /dev/sdb2

I don't know what I have done wrong but I ended up with an unbootable drive so I needed to revert it via the backup I've done previously.

Also lastone question. As I have to umount the partition, I reckon is impossible to do it with the same booted drive as Operative system?

Best Regards, let me know if you need further explanation of the doubt.

  • Yes, you're right. > I reckon is impossible to do it with the same booted drive as Operative system? – K7AAY Jul 5 '18 at 15:37
  • While the starting sector needs to remain the same, you can change the end sector as long as you're increasing it in value. sda3 starts right after sda2, which looks good to me. Why change sda3's starting sector? sda4 you'll have to scrap and restore the files from backup, but you should be able to increase the side of sda3. – Emmanuel Rosa Jul 6 '18 at 21:12

Your Answer

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

Browse other questions tagged or ask your own question.