You are not logged in.

#1 2024-03-25 15:19:09

MAYBL8
Member
Registered: 2022-01-14
Posts: 212

Help with modifying partitions

I don't do this very often so I am unsure on the best approach for this kind of thing.

I have several partitions on this system and want to remove some of them.
The first one I want to remove and reclaim the space is /dev/sda1.
Below lists the partitions on the system.
This is an MBR system and I'm worried about a couple of things
    1. If I delete the partition will the system still boot?
            Maybe I should just format the partition?
    2.  /dev/sda1 is a primary partition.  If I delete it will I lose the extended partitions?

What would be the best thing to do here?
Thanks

[demo@mail ~]$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda       8:0    0 931.5G  0 disk
├─sda1    8:1    0  27.9G  0 part
├─sda2    8:2    0     1K  0 part
├─sda5    8:5    0   3.9G  0 part [SWAP]
├─sda6    8:6    0 714.5G  0 part
├─sda7    8:7    0    40G  0 part
├─sda8    8:8    0   5.2G  0 part
├─sda9    8:9    0    40G  0 part /
└─sda10   8:10   0   100G  0 part /home
[demo@mail ~]$
[demo@mail ~]$ sudo parted -l
Model: ATA TOSHIBA DT01ACA1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  30.0GB  30.0GB  primary   ext4
 2      30.0GB  1000GB  970GB   extended
 5      30.0GB  34.2GB  4154MB  logical   linux-swap(v1)  swap
 7      34.2GB  77.1GB  42.9GB  logical   ext4
 8      77.1GB  82.6GB  5538MB  logical   ext4
 6      82.6GB  850GB   767GB   logical   ext4
10      850GB   957GB   107GB   logical   ext4
 9      957GB   1000GB  42.9GB  logical   ext4            boot

Last edited by MAYBL8 (2024-03-25 15:20:56)

Online

#2 2024-03-25 18:14:17

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Help with modifying partitions

MAYBL8 wrote:

If I delete the partition will the system still boot?

Yes, as long as you correct /etc/fstab (if the partition is listed there) and also providing you don't move /dev/sda9 around afterwards.

MAYBL8 wrote:

/dev/sda1 is a primary partition.  If I delete it will I lose the extended partitions?

The extended partitions are contained in /dev/sda2 so deleting /dev/sda1 should be "safe" in that respect.

Offline

#3 2024-03-26 13:53:55

MAYBL8
Member
Registered: 2022-01-14
Posts: 212

Re: Help with modifying partitions

Here is the fstab from the Arch Linux I am booted to.

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=e698137d-9896-4d17-9809-72de09446d27 /home          ext4    defaults,noatime 0 2
UUID=e34b9f78-6781-4bc2-826e-081af8c787e9 /              ext4    defaults,noatime 0 1
UUID=af44da39-5edf-4a16-b147-5ec69630affe none	swap	defaults 0 0

Here is the lsblk-f

[demo@mail ~]$ lsblk -f
NAME    FSTYPE FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1  ext4   1.0            a8e4106e-19c6-412d-b043-7d987ee9911d
├─sda2
├─sda5  swap   1              af44da39-5edf-4a16-b147-5ec69630affe                [SWAP]
├─sda6  ext4   1.0            aa9c71a7-0e93-49ec-add6-3bcde6e081ed
├─sda7  ext4   1.0   rootMX19 57150ded-c8fd-442f-8185-cecf657d136c
├─sda8  ext4   1.0   homeMX   3288406e-054a-4eab-82b1-d858d2d1441f
├─sda9  ext4   1.0            e34b9f78-6781-4bc2-826e-081af8c787e9   15.9G    54% /
└─sda10 ext4   1.0            e698137d-9896-4d17-9809-72de09446d27   86.2G     7% /home

It looks like it is safe to delete the /dev/sda1 partition.
The only think I am worried about is will it delete the MBR?
Not sure how that works.
Doesn't the MBR reside on a partition?
I won't do anything until I hear from you guys.
Thanks

Online

#4 2024-03-26 14:26:35

seth
Member
Registered: 2012-09-03
Posts: 51,560

Re: Help with modifying partitions

The MBR is ahead of the partition table, make sure to not create a partition starting before the first 1049kB (2048 is the default anyway)
What's your plan going on?

You'll probably not be able to only have an extended partition and the present one also doesn't cover the first 30GB and even if you were to grow the extended partition to the left the now free first 30GB are adjacent to the swap device only.

Offline

#5 2024-03-26 15:29:28

MAYBL8
Member
Registered: 2022-01-14
Posts: 212

Re: Help with modifying partitions

My plan is to relocate the swap partition if I even need one.
Remove all the other partitions except for the / (root) that is currently being used.
Grow the / (root) partition to an appropriate size.
Grow the /home  partition to the reclaimed space.
So what I am left with with be a / partition and a /home partition and a swap if I need one.
Let me know what you think for this plan.
I am comfortable with using Gparted to grow and shrink and create and move  partitions.

Online

#6 2024-03-26 15:48:11

seth
Member
Registered: 2012-09-03
Posts: 51,560

Re: Help with modifying partitions

You're essentially repartitioning everything.

I'd probably remove the unused logical partitions 5,6,7,8 shrink the extended partition to fit the remaining 150GB (9 & 10), grow the primary partition (pot align its start sector), move the home partition (10) there and grow the root partition to cover the entire last 150GB (or 118GB and keep 32GB swap if you don't want to use a swap file)
This way you only have to move the data on the home partition around.

Regardless, having backups before attemting this kind of complex disk operation is always a good idea.

Offline

Board footer

Powered by FluxBB