I have a 'My passport' external hard drive that I wanted to format to EXT4 to use for Linux Ubuntu 22.04.
The drive is almost empty but has a few files by default that I didn't mind keeping, so I tried to create a partition from about 1GB until the end of the disk. After running the formatting, my disk doesn't appear in my /media/username/
anymore. How can I cd
into this disk, and how can I check if it has been properly formatted to ext4?
I tried to follow this: Terminal method of formatting storage drive
Unfortunately, creating the partition led to some errors:
$ sudo parted /dev/sda1 mklabel gpt
Warning: Partition(s) on /dev/sda1 are being used.
Ignore/Cancel? Ignore
Warning: The existing disk label on /dev/sda1 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
Ignore/Cancel? Ignore
Information: You may need to update /etc/fstab.
It complained about the disk being in use, but I don't think I was doing anything with the disk. I had not opened files nor entered the disk, so I ignored the warning.
Then I tried to format the disk and tried to align the blocks:
$ sudo parted --align optimal /dev/sda1 -- mkpart primary ext4 1902592s -1s
Warning: You requested a partition from 974MB to 5001GB (sectors 1902592..9767471103).
The closest location we can manage is 974MB to 5001GB (sectors 1902592..9767471070).
Is this still acceptable to you?
Yes/No? Yes
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
Ignore/Cancel?
Since it's an external hard drive, I don't understand why I have to reboot, so I just unmounted the disk. When I mounted it back, it didn't appear any longer.
$ cd /media/username
$ ls
$
Does anyone have an idea how to mount the disk, how to fix the formatting if necessary, and how to handle these error messages?
sudo parted /dev/sda1 mklabel gpt
attempted to make a new partition table on an existing partition (not a drive!). ie. you're trying to create a nested list of partition tables on the same drive? Did you intend to instead do it to the drive? and not try and create a partition table within a partition on the pre-existing partition table as per your command? Your issue is likely related to what you've done & incorrect commands/understanding as you don't follow the doc you listed as I understand what you did. – guiverc Jan 16 '23 at 03:31