How To Resize ext3 Partitions Without Losing Data - Page 3
4 Merge Two ext3 Partitions
In this example I have my system partition /dev/sda1 again (about 6GB of size) which is followed directly by the partition /dev/sda3 (about 4GB of size) on the hard disk. /dev/sda3 is mounted to the /data directory and doesn't hold files needed by the Linux system, just user data. The current partitioning looks like this:
Filesystem Size Used Avail Use% Mounted on
To merge /dev/sda1 and /dev/sda3, we have to delete /dev/sda3 and then enlarge /dev/sda1 as described in chapter 3. This means that all data on /dev/sda3 will be lost, so if you need it later on please back it up somewhere else and then restore it to the new and bigger /dev/sda1 afterwards!
Now we open /etc/fstab and remove the line for /dev/sda3 there if it exists:
The new file without /dev/sda3 could look like this:
Then we unmount /dev/sda3 and run fdisk to delete it. This can still be done on the original system as /dev/sda3 doesn't contain system files:
(Yes, it's /dev/sda, not /dev/sda1.)
The number of cylinders for this disk is set to 1305.
Type m to get a list of all commands:
Command (m for help): m
Now let's delete /dev/sda3:
Command (m for help): d
Afterwards we write the new partition table to the disk:
Command (m for help): w
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
Now we shut down the system:
shutdown -r now
and boot into our Knoppix Live-CD (or your rescue system). From here on the steps are identical to chapter 3, beginning with
so please refer to that chapter.