[SOLVED}boot partition uses entire drive

rb61153

Member
Joined
Nov 5, 2023
Messages
80
Reaction score
0
Credits
599
I installed Linus Mint on an external drive and I am unable to access the drive. How can I re-partition the drive
 


I installed Linus Mint on an external drive and I am unable to access the drive. How can I re-partition the drive
Dude, that's a bummer. First things first, let's make sure the drive is recognized by your system. Open up a terminal and type in:

Code:
lsblk

This will list all the block devices on your system, including your external drive. Look for the device that corresponds to your external drive, it should be something like /dev/sdX (where X is a letter, like a, b, etc.).

Once you've identified the device, you can use the fdisk tool to re-partition it. Run the following command, replacing /dev/sdX with the actual device name:

Code:
sudo fdisk /dev/sdX

Inside fdisk interface, you can use the following commands:

  • p to print the current partition table
  • d to delete a partition
  • n to create a new partition
  • w to write the changes to the drive and exit

Remember to be super careful when making changes with fdisk because you don't want to accidentally wipe out any important data.

If you're not comfortable with fdisk, you can also try using graphical tools like GParted for a more user-friendly partitioning experience, just install it using:

Code:
sudo apt-get install gparted

Hope that helps, bro! Let me know if you need further assistance.
 
fdisk returns the following messge:
GPT PMBR size mismatch (5910963 != 3906963616) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
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 will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
 
fdisk returns the following messge:
GPT PMBR size mismatch (5910963 != 3906963616) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
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 will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Whoa, it looks like the drive is still in use and has an ISO 9660 signature. This means that it's being treated as a CD-ROM or DVD-ROM, which is why you're unable to repartition it.

To proceed, we need to unmount any file systems and disable any swap partitions on the drive. Open up a terminal and run the following commands:

Code:
sudo umount /dev/sdX
sudo swapoff -a

Replace /dev/sdX with the actual device name.

Once you've done that, you can try running the fdisk command again to re-partition the drive. Don't forget to be careful and double-check that you're working on the correct device.

If you're still having trouble, it might be worth checking if there's any software or services running that are using the drive. You can use tools like lsof or fuser to identify any processes that have files open on the drive and terminate them.

Let me know if you need any more help, dude!
 
Dude, that's a bummer. First things first, let's make sure the drive is recognized by your system. Open up a terminal and type in:

Code:
lsblk

This will list all the block devices on your system, including your external drive. Look for the device that corresponds to your external drive, it should be something like /dev/sdX (where X is a letter, like a, b, etc.).

Once you've identified the device, you can use the fdisk tool to re-partition it. Run the following command, replacing /dev/sdX with the actual device name:

Code:
sudo fdisk /dev/sdX

Inside fdisk interface, you can use the following commands:

  • p to print the current partition table
  • d to delete a partition
  • n to create a new partition
  • w to write the changes to the drive and exit

Remember to be super careful when making changes with fdisk because you don't want to accidentally wipe out any important data.

If you're not comfortable with fdisk, you can also try using graphical tools like GParted for a more user-friendly partitioning experience, just install it using:

Code:
sudo apt-get install gparted

Hope that helps, bro! Let me know if you need further assistance.
 
both
Code:
lsblk  and {CODE] return the message "Command not found"
 
both
Code:
lsblk  and {CODE] return the message "Command not found"
Aw, my bad, dude! It seems like the commands lsblk and fdisk are not available on your system.

To install the necessary packages, you can use the package manager. If you're using Ubuntu or a Debian-based distro, run the following command:

Code:
sudo apt-get install util-linux parted

If you're using Fedora or a Red Hat-based distro, use this command instead:

Code:
sudo dnf install util-linux parted

After installing these packages, you should be able to use the lsblk and fdisk commands without any issues.

Give it a shot and let me know if you need any further help, bro!
 
"
Code:
lsblk" and [\CODE] still return command not found message.  The install message states already present


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
parted is already the newest version (3.4-2build1).
util-linux is already the newest version (2.37.2-4ubuntu3).
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-76 linux-headers-5.15.0-76-generic
  linux-headers-5.15.0-78 linux-headers-5.15.0-78-generic
  linux-headers-5.15.0-82 linux-headers-5.15.0-82-generic
  linux-headers-5.15.0-84 linux-headers-5.15.0-84-generic
  linux-headers-5.15.0-86 linux-headers-5.15.0-86-generic
  linux-image-5.15.0-76-generic linux-image-5.15.0-78-generic
  linux-image-5.15.0-82-generic linux-image-5.15.0-84-generic
  linux-image-5.15.0-86-generic linux-modules-5.15.0-76-generic
  linux-modules-5.15.0-78-generic linux-modules-5.15.0-82-generic
  linux-modules-5.15.0-84-generic linux-modules-5.15.0-86-generic
  linux-modules-extra-5.15.0-76-generic linux-modules-extra-5.15.0-78-generic
  linux-modules-extra-5.15.0-82-generic linux-modules-extra-5.15.0-84-generic
  linux-modules-extra-5.15.0-86-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
 
Last edited:
"
Code:
lsblk" and [\CODE] still return command not found message.  The install message states already present

randy@randy-Inspiron-5582:~$ sudo apt-get install util-linux parted
[sudo] password for randy:            
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
parted is already the newest version (3.4-2build1).
util-linux is already the newest version (2.37.2-4ubuntu3).
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-76 linux-headers-5.15.0-76-generic
  linux-headers-5.15.0-78 linux-headers-5.15.0-78-generic
  linux-headers-5.15.0-82 linux-headers-5.15.0-82-generic
  linux-headers-5.15.0-84 linux-headers-5.15.0-84-generic
  linux-headers-5.15.0-86 linux-headers-5.15.0-86-generic
  linux-image-5.15.0-76-generic linux-image-5.15.0-78-generic
  linux-image-5.15.0-82-generic linux-image-5.15.0-84-generic
  linux-image-5.15.0-86-generic linux-modules-5.15.0-76-generic
  linux-modules-5.15.0-78-generic linux-modules-5.15.0-82-generic
  linux-modules-5.15.0-84-generic linux-modules-5.15.0-86-generic
  linux-modules-extra-5.15.0-76-generic linux-modules-extra-5.15.0-78-generic
  linux-modules-extra-5.15.0-82-generic linux-modules-extra-5.15.0-84-generic
  linux-modules-extra-5.15.0-86-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Oops, my bad again, bro! It seems like the commands lsblk and fdisk are not recognized on your system even after the installation.

No worries, though! We can use the parted command to accomplish what we need. Let's give it a shot. Run the following command in the terminal:

Code:
sudo parted -l

This will list all the block devices, including your external drive. Look for the device that corresponds to your external drive, it should be something like /dev/sdX (where X is a letter, like a, b, etc.).

Once you've identified the device, we can use the parted command to re-partition it. Run the following command, replacing /dev/sdX with the actual device name:

Code:
sudo parted /dev/sdX

Inside the parted interactive mode, you can use the following commands:

  • print to print the current partition table
  • rm to remove a partition
  • mkpart to create a new partition
  • quit to exit the parted interface and save the changes

Remember to be extra careful when making changes with parted! Double-check that you're working on the correct device to avoid any unwanted data loss.

If you're not comfortable with the command-line interface, you can also try using graphical tools like GParted for a more user-friendly partitioning experience. Just run the following command to install it:

Code:
sudo apt-get install gparted

Hope that does the trick, dude! Let me know if you need any further assistance.
 
Below are my lsblk results. Should I fdisk /dev/sda? I want to make the 1.8 T available for data

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 2.8G 0 part /media/randy/Linux Mint 21.2 Cinnamon 64-bit
└─sda2 8:2 0 4.1M 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1
│ 259:1 0 650M 0 part /boot/efi
├─nvme0n1p2
│ 259:2 0 128M 0 part
├─nvme0n1p3
│ 259:3 0 184.2G 0 part /media/OS
├─nvme0n1p4
│ 259:4 0 12.2G 0 part
├─nvme0n1p5
│ 259:5 0 1.2G 0 part
└─nvme0n1p6
 
Below are my lsblk results. Should I fdisk /dev/sda? I want to make the 1.8 T available for data

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 2.8G 0 part /media/randy/Linux Mint 21.2 Cinnamon 64-bit
└─sda2 8:2 0 4.1M 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1
│ 259:1 0 650M 0 part /boot/efi
├─nvme0n1p2
│ 259:2 0 128M 0 part
├─nvme0n1p3
│ 259:3 0 184.2G 0 part /media/OS
├─nvme0n1p4
│ 259:4 0 12.2G 0 part
├─nvme0n1p5
│ 259:5 0 1.2G 0 part
└─nvme0n1p6
Alright, dude! Based on your lsblk output, it looks like your external drive is /dev/sda, which has a size of 1.8TB. If you want to make the entire 1.8TB available for data, you indeed need to re-partition it.

To get started, you can run the fdisk command and pass in the device name /dev/sda:

Code:
sudo fdisk /dev/sda

Inside the fdisk interface, you can use the following commands to modify the partition table:

  • p: Print the current partition table
  • d: Delete a partition
  • n: Create a new partition
  • w: Write the changes to the drive and exit

Before proceeding with any modifications, make sure you have a backup of any important data on the drive, just to be safe.

Once you've created a new partition covering the entire drive, you may need to format it with a file system like ext4 or NTFS. To format the partition as ext4, you can use the following command:

Code:
sudo mkfs.ext4 /dev/sda1

Replace /dev/sda1 with the appropriate partition number if it differs.

After formatting, you can mount the partition to a directory of your choice using the mount command. For example:

Code:
sudo mount /dev/sda1 /mnt/mydrive

Remember to replace /dev/sda1 with the correct partition if needed, and /mnt/mydrive with the desired mount point.

That should do the trick, bro! Let me know if you have any further questions.
 
When I select "Format" the system currently thinks my external SSD drive is a USB stick and it is currently formatted as FAT32, if that matters. Fortunately, there is nothing on the SSD that I need to keep. I can format the external SSD and start from the beginning if needed. I do not know if I need to use NTFS or EXT4. What is the difference? As I said earlier, my wish is to have a bootable sector and then use the remainder of the external drive for data
 
When I select "Format" the system currently thinks my external SSD drive is a USB stick and it is currently formatted as FAT32, if that matters. Fortunately, there is nothing on the SSD that I need to keep. I can format the external SSD and start from the beginning if needed. I do not know if I need to use NTFS or EXT4. What is the difference?
No problem, dude! If you don't have any important data on the external SSD, it's totally cool to format it and start fresh.

The main difference between NTFS and EXT4 file systems is the operating system support and some features.

NTFS is a file system that originated from Windows. It offers good compatibility with Windows systems, supports file permissions and encryption, and can handle large file sizes. It's a solid choice if you plan on using the external SSD mainly with Windows machines.

EXT4, on the other hand, is a file system commonly used in Linux systems. It has robust performance, supports journaling for enhanced data integrity, and provides good compatibility with Linux distributions. If you're planning to use the external SSD primarily with Linux or Linux-based systems, EXT4 is a great option.

To format the external SSD with NTFS, you can use the following command:

Code:
sudo mkfs.ntfs /dev/sda1

To format with EXT4, use this command instead:

Code:
sudo mkfs.ext4 /dev/sda1

Replace /dev/sda1 with the appropriate partition number if it differs.

After formatting, you can proceed with the steps I mentioned earlier to mount the partition and start using the external SSD.

Ultimately, the choice between NTFS and EXT4 depends on your intended use and the operating systems you plan to work with. If you're going to primarily use it with Linux, I'd recommend going with EXT4 for the best compatibility and performance.

Let me know if you need any further assistance, bro!
 
The command - sudo mkfs.ext4 /dev/sda1 returns the message below.


mke2fs 1.46.5 (30-Dec-2021)
The file /dev/sda1 does not exist and no size was specified


Should I try sudo mkfs.ext4 /dev/sda (sda appears to be the 1.8TB unallocated space on the external drive) ?
I unplugged the external drive and booted from my PC's hard drive, but it seems the system is confused by the external drive being a boot disk also.
 
The command - sudo mkfs.ext4 /dev/sda1 returns the message below.


mke2fs 1.46.5 (30-Dec-2021)
The file /dev/sda1 does not exist and no size was specified


Should I try sudo mkfs.ext4 /dev/sda (sda appears to be the 1.8TB unallocated space on the external drive) ?
I unplugged the external drive and booted from my PC's hard drive, but it seems the system is confused by the external drive being a boot disk also.
Apologies for the confusion, dude! If the partition on the external SSD is not labeled as /dev/sda1, then it makes sense that the command sudo mkfs.ext4 /dev/sda1 is producing an error.

In your case, if the unallocated space on the external drive is labeled as /dev/sda, you can format it directly with the following command:

Code:
sudo mkfs.ext4 /dev/sda

This command will format the entire drive as the ext4 file system.

Since you mentioned that you also want a bootable sector on the external drive, keep in mind that formatting the entire drive will remove any existing bootable sector or operating system that may be present on it. If you want to preserve the bootable sector, you might need to look into cloning or replicating the bootable sector from your PC's hard drive to the external SSD.

However, if you're okay with starting fresh and don't need to preserve any existing bootable sector, then formatting the entire drive as ext4 should work fine for your intended use.

Let me know if you have any more questions or need further assistance, bro!
 
That's the problem, it won't let me format the SSD drive

The command - sudo mkfs.ext4 /dev/sda1 returns the message below.

mke2fs 1.46.5 (30-Dec-2021)
/dev/sda1 is apparently in use by the system; will not make a filesystem here!

I had previously attempted to install Cinnamon 21.2 on the SSD drive, but even though I boot from the PC's hard drive, the operating system appears to be using the SSD drive even when I have it unmounted.
 
That's the problem, it won't let me format the SSD drive

The command - sudo mkfs.ext4 /dev/sda1 returns the message below.

mke2fs 1.46.5 (30-Dec-2021)
/dev/sda1 is apparently in use by the system; will not make a filesystem here!

I had previously attempted to install Cinnamon 21.2 on the SSD drive, but even though I boot from the PC's hard drive, the operating system appears to be using the SSD drive even when I have it unmounted.
I apologize for the inconvenience, dude. It seems that the partition on the external SSD drive is still in use by the system, even when it's unmounted. This can sometimes happen if there are still open files or processes tied to that partition.

To format the partition successfully, you can try booting into a live environment using a USB drive or DVD. This way, the operating system running from the USB or DVD won't have any association with the files or processes on the SSD drive.

Once you're in the live environment, open the terminal and run the following command to list the available partitions:

Bash:
sudo fdisk -l

Identify the partition you wish to format on the SSD drive, and note its device name (e.g., /dev/sda1, /dev/sda2).

Then, format the partition using the mkfs.ext4 command as you mentioned before, but using the appropriate device name:

Bash:
sudo mkfs.ext4 /dev/sda1

Make sure to replace /dev/sda1 with the correct device name you identified.

By formatting the partition in the live environment, you should be able to successfully create a new ext4 file system without any interference from the system.

If you continue to encounter issues or if formatting the partition is still not possible, it might be worth considering using alternative partitioning tools like GParted or Disks to manage the SSD drive's partitions.

Keep me posted, and I'm here if you need further assistance, bro!
 
Sorry, I'm lost. Here are the results from the command- sudo fdisk -l The first set of results (/dev/nvme0n1p1 are from my laptop hard drive,

Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: KBG40ZNS256G NVMe TOSHIBA 256GB
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: gpt
Disk identifier: 770 770CBB

Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1333247 1331200 650M EFI System
/dev/nvme0n1p2 1333248 1595391 262144 128M Microsoft reserved
/dev/nvme0n1p3 1595392 387874815 386279424 184.2G Microsoft basic data
/dev/nvme0n1p4 471842816 497496063 25653248 12.2G Windows recovery environment
/dev/nvme0n1p5 497498112 500084735 2586624 1.2G Windows recovery environment
/dev/nvme0n1p6 387874816 471842815 83968000 40G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/sda: 1.82 TiB, 2000365371904 bytes, 3906963617 sectors
Disk model: Extreme 55AE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: 7F710194-2-5155CFB1273A

Device Start End Sectors Size Type
/dev/sda1 64 5902403 5902340 2.8G Microsoft basic data
/dev/sda2 5902404 5910899 8496 4.1M EFI System

Is Windows tying up the disk space on the external drive? I don't use or want Windows on my PC hard drive or anywhere for that matter. Can I maybe remove windows completely?
 
Sorry, I'm lost. Here are the results from the command- sudo fdisk -l The first set of results (/dev/nvme0n1p1 are from my laptop hard drive,

Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: KBG40ZNS256G NVMe TOSHIBA 256GB
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: gpt
Disk identifier: 770 770CBB

Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1333247 1331200 650M EFI System
/dev/nvme0n1p2 1333248 1595391 262144 128M Microsoft reserved
/dev/nvme0n1p3 1595392 387874815 386279424 184.2G Microsoft basic data
/dev/nvme0n1p4 471842816 497496063 25653248 12.2G Windows recovery environment
/dev/nvme0n1p5 497498112 500084735 2586624 1.2G Windows recovery environment
/dev/nvme0n1p6 387874816 471842815 83968000 40G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/sda: 1.82 TiB, 2000365371904 bytes, 3906963617 sectors
Disk model: Extreme 55AE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: 7F710194-A624-43FA-9BA2-5155CFB1273A

Device Start End Sectors Size Type
/dev/sda1 64 5902403 5902340 2.8G Microsoft basic data
/dev/sda2 5902404 5910899 8496 4.1M EFI System

Is Windows tying up the disk space on the external drive? I don't use or want Windows on my PC hard drive or anywhere for that matter. Can I maybe remove windows completely?
No worries, dude! I can see from the output that your external drive is labeled as
Code:
/dev/sda
. However, it looks like the drive already contains partitions that are associated with Windows, such as
Code:
/dev/sda1
.

If you want to remove Windows completely and utilize the entire external drive for your Linux system, you can remove those Windows partitions and create new ones.

Before proceeding, please note that removing partitions will delete all data stored on them. Make sure you have backups of any important data you may need before proceeding.

To remove the Windows partitions, you can use the following steps:

1. Open a terminal and run the command:

Code:
sudo fdisk /dev/sda

2. Once inside the fdisk interactive mode, type
Code:
d
and press [Enter] to delete a partition.

3. You will be prompted to enter the partition number. Enter the partition number you want to delete, such as
Code:
1
for /dev/sda1, and press [Enter].

4. Repeat the steps to delete any other Windows partitions present on the external drive.

5. After deleting the Windows partitions, you can create a new partition to utilize the entire drive. Type
Code:
n
and press [Enter] to create a new partition.

6. Follow the prompts to specify the partition size and type. You can press [Enter] to select the default values to use the entire available space.

7. Once the new partition is created, type
Code:
w
and press [Enter] to write the changes to the drive and exit fdisk.

After removing the Windows partitions and creating a new partition, you can format the partition with the ext4 file system as before:

Code:
sudo mkfs.ext4 /dev/sda1

Finally, you can mount the partition and use it for your Linux system.

Keep in mind that removing the Windows partitions will permanently delete all data on them. Make sure you have backed up any important files before proceeding.

Let me know if you have any further questions or if there's anything else I can help you with, bro!
 

Members online


Top