Can I resize "/" partition?

General support questions
User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Can I resize "/" partition?

Post by TrevorH » 2019/01/06 11:36:40

You cannot merge two filesystems without having enough space on one of them already to be able to copy the files over from one to the other.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

George99
Posts: 74
Joined: 2013/09/08 17:01:05
Location: Germany

Re: Can I resize "/" partition?

Post by George99 » 2019/01/06 11:38:06

First you wrote to shrink the root partition which resides on sda, but now you want to merge two partitions on sdb which seems not to be mounted.
the latter task will be easier but first of all to a full backup of all your data on both sdb partitions!

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Can I resize "/" partition?

Post by hack3rcon » 2019/01/06 11:53:58

George99 wrote:
2019/01/06 11:38:06
First you wrote to shrink the root partition which resides on sda, but now you want to merge two partitions on sdb which seems not to be mounted.
the latter task will be easier but first of all to a full backup of all your data on both sdb partitions!
Yes, I want to increase "/" partition size but I like to merge "sdb" partitions first. I know backup is important always but maybe my files removed on "sdb" partitions?

mashiro2004
Posts: 68
Joined: 2018/12/08 21:46:22
Location: Italy

Re: Can I resize "/" partition?

Post by mashiro2004 » 2019/01/06 14:55:10

hack3rcon wrote:
2019/01/06 11:30:32
mashiro2004 wrote:
2019/01/06 10:44:13
It Is possibile to extend partition in unallocated space only. If you have enought space you Can shrink sdb2, extend sdb1 move data fronte sdb2 in sdb1 destroy sdb2 and extend sdb1. With lvm volume is more flexible, because you Can add phisical disk to volume move data and the remove....
Can you write properly commands here?
Thank you.
Ok First Mount sdb1 and sdb2 a send the output of df -h to see free space in partitions

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Can I resize "/" partition?

Post by hack3rcon » 2019/01/07 06:20:49

mashiro2004 wrote:
2019/01/06 14:55:10
hack3rcon wrote:
2019/01/06 11:30:32
mashiro2004 wrote:
2019/01/06 10:44:13
It Is possibile to extend partition in unallocated space only. If you have enought space you Can shrink sdb2, extend sdb1 move data fronte sdb2 in sdb1 destroy sdb2 and extend sdb1. With lvm volume is more flexible, because you Can add phisical disk to volume move data and the remove....
Can you write properly commands here?
Thank you.
Ok First Mount sdb1 and sdb2 a send the output of df -h to see free space in partitions
OK, I mounted them and just copy some files and directories for test:

Code: Select all

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        33G 1009M   31G   4% /
udev             10M     0   10M   0% /dev
tmpfs           201M  3.0M  198M   2% /run
tmpfs           501M     0  501M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           501M     0  501M   0% /sys/fs/cgroup
tmpfs           101M     0  101M   0% /run/user/0
tmpfs           101M     0  101M   0% /run/user/1001
/dev/sdb1        50G   52M   47G   1% /mnt/1
/dev/sdb2        50G   52M   47G   1% /mnt/2

mashiro2004
Posts: 68
Joined: 2018/12/08 21:46:22
Location: Italy

Re: Can I resize "/" partition?

Post by mashiro2004 » 2019/01/07 11:52:21

Hi,
but if sdb1 and sdb2 are empty.... You can or remove sdb1 and sdb2 and create only 1 partition sdb1:
unmount sdb1 and sdb2
fdisk /dev/sdb
d (delete)
1 (is the number of partition to delete)
d (delete)
2 (is the number of partition to delete)
w (write changes)
n (create new partition)
p (primary)
1 (number of partition)
enter (first cilinder)
enter (last cilinder)
w

Now you have 1 partition of 100gb
You must now format in ext4
mkfs.ext4 /dev/sdb1

Now you can mount you partition

If are not empy you can:


Copy all file and folders from sdb2 to sdb1. and backup everything to an external drive.
fdisk /dev/sdb
d (delete)
2 (is the number of partition to delete)
w (write changes)

resize2fs /dev/sdb1

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Can I resize "/" partition?

Post by hack3rcon » 2019/01/07 12:16:25

mashiro2004 wrote:
2019/01/07 11:52:21
Hi,
but if sdb1 and sdb2 are empty.... You can or remove sdb1 and sdb2 and create only 1 partition sdb1:
unmount sdb1 and sdb2
fdisk /dev/sdb
d (delete)
1 (is the number of partition to delete)
d (delete)
2 (is the number of partition to delete)
w (write changes)
n (create new partition)
p (primary)
enter (first cilinder)
enter (last cilinder)
w

Now you have 1 partition of 100gb
You must now format in ext4
mkfs.ext4 /dev/sdb1

Now you can mount you partition

If are not empy you can:


Copy all file and folders from sdb2 to sdb1. and backup everything to an external drive.
fdisk /dev/sdb
d (delete)
2 (is the number of partition to delete)
w (write changes)

resize2fs /dev/sdb1
I removed "sdb2" but:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /dev/sdb1' first.
And:

Code: Select all

# e2fsck -f /dev/sdb1
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 15/3276800 files (0.0% non-contiguous), 251703/13107200 blocks
And:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 13107200 (4k) blocks long.  Nothing to do!

mashiro2004
Posts: 68
Joined: 2018/12/08 21:46:22
Location: Italy

Re: Can I resize "/" partition?

Post by mashiro2004 » 2019/01/07 12:18:54

hack3rcon wrote:
2019/01/07 12:16:25
mashiro2004 wrote:
2019/01/07 11:52:21
Hi,
but if sdb1 and sdb2 are empty.... You can or remove sdb1 and sdb2 and create only 1 partition sdb1:
unmount sdb1 and sdb2
fdisk /dev/sdb
d (delete)
1 (is the number of partition to delete)
d (delete)
2 (is the number of partition to delete)
w (write changes)
n (create new partition)
p (primary)
enter (first cilinder)
enter (last cilinder)
w

Now you have 1 partition of 100gb
You must now format in ext4
mkfs.ext4 /dev/sdb1

Now you can mount you partition

If are not empy you can:


Copy all file and folders from sdb2 to sdb1. and backup everything to an external drive.
fdisk /dev/sdb
d (delete)
2 (is the number of partition to delete)
w (write changes)

resize2fs /dev/sdb1
I removed "sdb2" but:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /dev/sdb1' first.
And:

Code: Select all

# e2fsck -f /dev/sdb1
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 15/3276800 files (0.0% non-contiguous), 251703/13107200 blocks
And:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 13107200 (4k) blocks long.  Nothing to do!
Have you unmounted sdb1? if not unmount it ad re-launch commands

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Can I resize "/" partition?

Post by hack3rcon » 2019/01/07 12:27:00

mashiro2004 wrote:
2019/01/07 12:18:54
hack3rcon wrote:
2019/01/07 12:16:25
mashiro2004 wrote:
2019/01/07 11:52:21
Hi,
but if sdb1 and sdb2 are empty.... You can or remove sdb1 and sdb2 and create only 1 partition sdb1:
unmount sdb1 and sdb2
fdisk /dev/sdb
d (delete)
1 (is the number of partition to delete)
d (delete)
2 (is the number of partition to delete)
w (write changes)
n (create new partition)
p (primary)
enter (first cilinder)
enter (last cilinder)
w

Now you have 1 partition of 100gb
You must now format in ext4
mkfs.ext4 /dev/sdb1

Now you can mount you partition

If are not empy you can:


Copy all file and folders from sdb2 to sdb1. and backup everything to an external drive.
fdisk /dev/sdb
d (delete)
2 (is the number of partition to delete)
w (write changes)

resize2fs /dev/sdb1
I removed "sdb2" but:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /dev/sdb1' first.
And:

Code: Select all

# e2fsck -f /dev/sdb1
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 15/3276800 files (0.0% non-contiguous), 251703/13107200 blocks
And:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 13107200 (4k) blocks long.  Nothing to do!
Have you unmounted sdb1? if not unmount it ad re-launch commands
I umounted partitions.

mashiro2004
Posts: 68
Joined: 2018/12/08 21:46:22
Location: Italy

Re: Can I resize "/" partition?

Post by mashiro2004 » 2019/01/07 12:31:26

hack3rcon wrote:
2019/01/07 12:27:00
mashiro2004 wrote:
2019/01/07 12:18:54
hack3rcon wrote:
2019/01/07 12:16:25


I removed "sdb2" but:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
Please run 'e2fsck -f /dev/sdb1' first.
And:

Code: Select all

# e2fsck -f /dev/sdb1
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 15/3276800 files (0.0% non-contiguous), 251703/13107200 blocks
And:

Code: Select all

# resize2fs /dev/sdb1 
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 13107200 (4k) blocks long.  Nothing to do!
Have you unmounted sdb1? if not unmount it ad re-launch commands
I umounted partitions.
try this way:

parted
select /dev/sdb
resizepart
1

Post Reply