Suppose your disk layout looks like this:
(parted) print Disk geometry for /dev/hda: 0-8063.5 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.0 23.5 primary ext2 boot 2 23.5 8056.0 extended 5 23.6 3545.6 logical ext2 6 3545.6 7067.7 logical ext2 7 7067.7 7326.5 logical ext2 8 7326.5 7585.4 logical ext2 9 7585.4 7844.2 logical linux-swap $ df -h Filesystem Size Used Avail Use% Mounted on /dev/hda8 251M 31M 207M 13% / /dev/hda1 23M 2.4M 19M 11% /boot /dev/hda5 3.4G 577M 2.7G 18% /usr /dev/hda6 3.4G 289M 2.9G 9% /home /dev/hda7 251M 12M 226M 5% /var
Suppose you wanted to increase the `/var' partition (`/dev/hda7') to 1GB, using some space from `/home' (`/dev/hda6').
To resize a partition with Parted, you use the resize command:
(parted) resize partition_number new start new end
new start must be the same as the old start for ext2 partitions (unfortunately). So this process is going to be rather complicated. It is possible, though. (2)
# parted /dev/hda (parted) resize 6 3545.6 6200
(parted) mkpartfs logical ext2 6200 7067.7
(parted) cp 7 10
(parted) rm 7At this point: all logical partitions greater than 7 just changed number. So 8, 9 and 10 become 7, 8 and 9 respectively. This renumbering won't take place while any partitions are mounted on that disk (this will happen when you reboot). That's what that warning message is talking about. So you should never attempt to mount a file system touched by Parted (resized or created by Parted), before rebooting, if you get this message.
(parted) resize 9 6200 7326.5 (parted) quit Warning: The kernel was unable to re-read the partition table on /dev/hda (Device or resource busy). This means Linux knows nothing about any modifications you made. You should reboot your computer before doing anything with /dev/hda.
/dev/hda8 / ext2 defaults 1 1 /dev/hda1 /boot ext2 defaults 1 2 /dev/hda6 /home ext2 grpquota,usrquota 0 2 /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0 /dev/hda5 /usr ext2 defaults 1 2 /dev/hda7 /var ext2 grpquota,usrquota 0 2 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 none /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 /dev/hda9 swap swap defaults 0 0A few lines need to be changed:
/dev/hda7 / ext2 defaults 1 1 /dev/hda1 /boot ext2 defaults 1 2 /dev/hda6 /home ext2 grpquota,usrquota 0 2 /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0 /dev/hda5 /usr ext2 defaults 1 2 /dev/hda9 /var ext2 grpquota,usrquota 0 2 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 none /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 /dev/hda8 swap swap defaults 0 0
Go to the first, previous, next, last section, table of contents.