deleting partitions on second disk ( the old boot disk)

Leap V15-64 + KDE

I just did a fresh install of Leap-15 onto a new disk.

I’m mounting my old Leap-42.3 disk as a second disk and want to delete unused system partitions.

Can I do this?

When I boot, the OS “sees” the old Leap-42.3 disk and offers it as a boot option, dev/sdb8

When looking at the second old disk with yast/partition, it appears as dev/sdb with sdb1, …, sdb6, and types of WDC-WDC…, Linux Native, Linux LVM, Extended, and swap.

Which of these may be deleted?

In the end I want to edit the partition with my data and make it bigger.

Does this make sense or am I flirting with disaster?

Thank you.

Use YaST’s partitioner. Delete the partitions on /dev/sdb , then create new ones as you like, incl desired mountpoints. After doing so, run YaST’s Bootloader module. It will detect the changes, and remove the 42.3 entries. Hit OK, reboot and done.

Yes.

When I boot, the OS “sees” the old Leap-42.3 disk and offers it as a boot option, dev/sdb8

When looking at the second old disk with yast/partition, it appears as dev/sdb with sdb1, …, sdb6, and types of WDC-WDC…, Linux Native, Linux LVM, Extended, and swap.

Which of these may be deleted?
It depends which have data you wish to keep, which partition(s) you wish to enlarge. If you show us content of etc/fstab/ on the sdb8 partition and output from ‘gdisk -l /dev/sdb’ we should be able to make recommendations.

   sudo gdisk -l /dev/sdc  

yields

 GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************

Disk /dev/sdc: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0C9BFB9A-DF7A-4F93-9447-53A4AE7146E1
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 8-sector boundaries
Total free space is 184590447 sectors (88.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048           1026047     500.0 MiB   8300  Linux filesystem
   5         1026050         1028095    1023.0 KiB  8E00  Linux LVM
   6       185616384      3907028991   1.7 TiB     8300  Linux filesystem

  

I already deleted some partitions, like swap.

By right clicking properties, I’m pretty sure my data is on dev/sdc6.

This is the partition created by Leap 42.3 for user data, right?

Just delete dev/sdc1 and dev/sdc5, then run the bootloader?

Thank you.

There’s no need to guess. You can mount it and take a look. If yes, then…

Just delete dev/sdc1 and dev/sdc5, then run the bootloader?
… go ahead.

What’s the difference between dev/sdc2 extended type with 1.82 Tb and dev/sdc5 Linux native with 1,73 Tb?

Go here SDB:Basics of partitions, filesystems, mount points - openSUSE Wiki aend read the part about Primary, Extended and Logical Partitions.

Nice link, the extended partition overcomes the 4 partition limit.

So it’s OK to delete the dev/sdc2 extended type with 1.82 Tb, right?

It’s not mounted, and it’s not encrypted.

Sure if it is not used and any partition in it are not being used you can remove it. But remember extended partitions are just containers for other partitions to get around the 4 partition limit on DOS partitioning and they them selves are not mounted but partition in them may be so be sure,

Maybe it would help if you remember an extended partition cannot be formatted. Instead of one filesystem, which is what all others are intended for, the extended holds definitions of logical partitions, one sector for each. It’s the logicals, minus the sectors allocated in making up the definitions, that actually use the space you see allocated to the extended.

Q1) Does the extended file system contain information about all the disk partitions or just partitions 5 and higher?

Q2) If I delete the extended, I also delete the useful data partition, right?

Q3) Why doesn’t sudo gdisk -l /dev/sdc list the extended file system?

Thank you.

“Extended File System” is what e.g. EXT2, EXT3 & EXT4 refer to, having nothing directly to do with partitioning.

The extended partition, unlike the logicals and other primaries, is a label for a virtual object that can contain directly no files or filesystem. It’s defined by the partitions it contains, or the partitions and freespace it contains, according to the way the particular partitioning tool presents it.

The extended partition lists only #5 and above because each “partition” is defined by one 16 byte block in a partition “table”. The MBR table contains 64 bytes, 4 entries entries maximum, so the next is logically the fifth, and named “logical”.

Q2) If I delete the extended, I also delete the useful data partition, right?
Yes, if using a partition tool that lets you. Smarter tools present the extended only by virtue of the logical partitions it does let you create, delete, move or resize, not letting you alter the extended directly in any way.

Q3) Why doesn’t sudo gdisk -l /dev/sdc list the extended file system?
It’s a presentation. Listing a partition that cannot host a filesystem directly serves mainly to confuse someone trying to understand MBR partitioning, why 2 and/or 3 and/or 4 might be absent.

Use

fdisk -l

to see all the partitions (including extended ones on MBR partitioned disks.

And when you are not interested anymore in any data one a disk, just createa n empty partitiontable on it:

fdisk /dev/sdc

(take the correct one for sdc or you will destroy the wrong thing!!!)
Then enter one after another the following commands

o
w

These stand for:
o create a new empty DOS partition table
w write table to disk and exit

This will remove all your worrying.

From there on you can go and use the device for what you want to use it for. E.g. starting to partition it with YaST > System > Partitioner.

Use “fdisk” for that.

Use “gdisk” for disks with GPT partitioning (which is now becoming more common). Use “fdisk” for disks with legacy MBR/BIOS style partitioning.

If there is a Extended Partition, then the disk us using legacy partitioning.

I really appreciate your help.

My goal is to create a 3 disk system, disk-one for the OS, disk-two for my-personal-data, and disk-three as a backup.

I screwed up my 42.3 machine but still want to use that old disk as the disk-two, because it already has my-personal-data on it. I want to delete all the partitions on it except for my-personal-data, and then enlarge that partition to use the entire disk with a single partition.

I’m thinking about copying (rsyncing) my-personal-data to a disk, then partitioning-formatting-copying (rsyncing) my-personal-data back to the original disk. The problem is that the copying (rsyncing) NEVER goes smoothly. There’s always some issue, the system hangs or there’s a permission issue. I’m talking about 1Tb of data and ~5hours.

Doing a copy, followed by 1 or 2 rsyncs seems to be the best way. But I have no way to compare the disks so I don’t have 100% confidence that the data is getting moved without errors.

Anyway,... 

 Q1) How can I be sure that my-personal-data won't become inaccessible if I delete the extended partition?      

Q2) Is there a directory to directory comparison tool with say an md5 checksum as the basis for comparison, not just dates and file sizes?

Type mount to see where all things ae mounted. Note the partition that hosts /home If it is a logical in the extended it is best not to delete the extended… fdisk -l will show you what is where. Note the beginning and end block number of each partition any that fall between the begin end blocks of the extended are logical in that extended. Generally any partition number above 5 are logical but that may not be written in stone and depends on the history of the disk’s partition creation so best to note start end block numbers.

You have a long nice story, but nor much hard data. So best is to provide some we can discuss. Please show

fdisk -l

and then add information about all the partitions there: what you think they are used for. And then explain what disks you want to use for in the future. Ther result will be that we can call names, like you can delet sdf7. or you can remove all from sde and then create sde1 with size …

Then I hope we all (inclusing you) will understand what we are talking about.

Making progress, here’s fdisk -l

sda is my backup disk, with a new partition
sdb is the new V15 boot disk, with a new partition
sdc is the old 42.3 disk with my personal data, with the extended partition



Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000ed722

Device     Boot Start        End    Sectors  Size Id Type
/dev/sda1        2048 3907029167 3907027120  1.8T 83 Linux

Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0000c861

Device     Boot     Start        End    Sectors  Size Id Type
/dev/sdc2         1026048 3907028991 3906002944  1.8T  f W95 Ext'd (LBA)
/dev/sdc5       185616384 3907028991 3721412608  1.8T 83 Linux

Disk /dev/sdb: 186.3 GiB, 200049647616 bytes, 390721968 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: gpt
Disk identifier: 0215A769-485A-4130-A174-64D7C56EA4E5

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048     18431     16384     8M BIOS boot
/dev/sdb2      18432  83904511  83886080    40G Linux filesystem
/dev/sdb3   83904512 374439935 290535424 138.6G Linux filesystem
/dev/sdb4  374439936 390721934  16281999   7.8G Linux swap

Disk /dev/mapper/cr_sda4: 7.8 GiB, 8334286336 bytes, 16277903 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

Disk /dev/mapper/cr_sda2: 40 GiB, 42947575808 bytes, 83881984 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

Disk /dev/mapper/cr_sda3: 138.5 GiB, 148752039936 bytes, 290531328 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

Disk /dev/mapper/luks-e7f33a60-a536-41a3-8209-bd5319f0d272: 1.8 TiB, 1905361158144 bytes, 3721408512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/cr_ata-WDC_WD20EZRX-00D8PB0_WD-WCC4M8VDDEU2-part1: 1.8 TiB, 2000395788288 bytes, 3907023024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


And in conclusion,

  1. using yast/pertitioner, deleting the extended drive deletes my-data-partition, so I back track with abort-cancel.
  2. resizing my-data-partition is not possible because "combined limitations of partition and filesystem prevent resizing.

I was away and I am not sure if you are still wrestling with this simple case.

First please always try to be very explicit in wording. You posted the fdisk -l listing, so now we all can see what is what. Then you should call the correct names. So not “the extended dtrive”, but “sdc2”. Then the can be no confusion about what you mean.

I assume we are talking about sdc:

Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectorsUnits: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0000c861


Device     Boot     Start        End    Sectors  Size Id Type
/dev/sdc2         1026048 3907028991 3906002944  1.8T  f W95 Ext'd (LBA)
/dev/sdc5       185616384 3907028991 3721412608  1.8T 83 Linux

As sdc5 is a logical partition and thus part of the extended partition, which is sda2, you have first to remove sdc5, after that you can remove the now empty sdc2.

But you can do it all on one by using what I already told you 10 days ago in post #13 above.

Still assuming that there is NOTHING important on sdc and you want to go for a fresh start using sdc fror something.