OK. Based on some testing, the following steps should do the job for
you. The first few steps do the file system resizing and adjusting the
partition sizes / create the new one(s).
FILE SYSTEM AND PARTITION CHANGES
I've marked a few steps with (* and #a/#b) if the file system is
really messed up. From the numbers you mention, it appears you want
about 40G for the new partition. The /data1 partition will be about
180G after this is done. Adjust the numbers (e.g., 171G, +180G) if you
want different sizes.
 Verify that the partition to shrink (/dev/sdb2) is not mounted.
Use umount if necessary.
 (* not needed) e2fsck -f /dev/sdb2
to check the file system / verify it is in a consistent state. -f
forces the check. See
for more options if desired.
 (* not needed) resize2fs -p /dev/sdb2 171G
Resize the file system to the desired size. I suggest a size about 5%
smaller than 180G because you don't have to get the partition size
exactly right (and you will quickly resize to use all the space in
step 5a). This took a several minutes on my system (3G) but with the
33G used on your system it could be an hour or so. I suggest not
stopping this step once started (or it will corrupt your file system).
for more options if desired.
 fdisk /dev/sdb
to print the partition table / confirm what you have already reported.
to delete the second partition
1045 (should be the default value)
to create the second primary partition with size 180G (slightly less usable)
to print the table / note the last cylinder of the second partition
[last cylinder of 2nd partition + 1] (should be the default value)
[last cylinder of the disk] (should be the defaut value)
to create the third primary partition sized to take the rest of the
disk. If you want two partitions instead of one, you can create a 3rd
and 4th primary partition if desired. Just repeat the steps using the
to write the partition table. You will get a few messages before fdisk
exits and you are back to the command line prompt. For explanations of
fdisk, the man page at
is not nearly as helpful as a tutorial in the Gentoo handbook at
or the Linux partition HOWTO at
Both of the latter explain the commands once you run fdisk much better
than the man page does.
NOTE: before 4a, e2fsck -f /dev/sdb2 may be necessary (it was not in my testing).
[5a] (* not needed) resize2fs -p /dev/sdb2
to resize the partition on sdb2 to use the entire space. On my system
this was pretty quick - but you may see a message about adding inodes.
[5b] (*) mke2fs -j -L /data1 /dev/sdb2
If the partition was messed up, just rebuild it with this command
line. This turns on journaling (ext3) and sets the file system label
to /data1. You may want to review
for additional options.
 mke2fs -j -L /usr /dev/sdb3
to create the file system (type ext3) on the new partition. Repeat
with a different label if you create two partitions instead of one.
The label by the way is optional but can help in case you move
partitions / add disks by avoiding the use of physical disk partition
At this point, you have the partitions set up the way you want them
but the new one will not be mounted at start up and the new partition
does not have the contents desired.
Adjust the command line parameters (e.g., sdb4 for sdb3, var for usr)
if you need to repeat the commands for more than one partition.
To move the contents at this point, you need to mount the old & new
partitions at a temporary location. Something like
mount -t ext3 /dev/sdb2 /tmp/sdb2
mount -t ext3 /dev/sdb3 /tmp/sdb3
should do the job. The first two steps create empty directories to act
as mount points and the last two steps mount the drives in the
To copy the files, I suggest using a bulk copy program such as rsync.
Yes - I know it is a program normally used to copy files across the
network, but it works just fine locally as well. There are a LOT of
options to rsync, but the simplest method is something like
rsync -a /tmp/sdb2/usr/ /tmp/sdb3
which will copy all the files from the old partition at /usr/ (and
recursively all sub directories) in "archive mode" which preserves
ownership, permissions, time stamps, etc. The only thing this does NOT
do is to preserve hard links (a single file located at more than one
spot in the hierarchy). If you must preserve hard links, use
rsync -aH /tmp/sdb2/usr/ /tmp/sdb3
but the documentation indicates it is MUCH slower. Another note - be
sure to include the trailing slash on the source directory - it is
described in the man page as well, but this forces the contents of
/usr/ to appear in /tmp/sdb3 (and not in /tmp/sdb3/usr).
If you have a backup / restore program you could use that instead to
copy the files.
After copying the files and confirming they are correct - you should
probably remove them from the old location. Use
\rm -rf /usr
[be VERY careful with entering this command...]
to remove the files from the old location.
Now - the changes to the fstab file are pretty straight forward. See
for an explanation of the fields in the file.
The lines you showed should be kept as-is. For the new partition(s),
you need to add lines like these:
LABEL=/usr /usr ext3 defaults 1 2
The LABEL= parameter refers to the file system label added above. The
/usr parameter refers to where the file system will be mounted. This
should be an empty directory (but if not empty its contents are
ignored after the mount is done). The ext3 parameter refers to the
file system type. Now "defaults" mean that the default mount options
are used. See
for explanations of the mount options. The last two options refer to
when the file system is dumped (for backups) and when it is mounted at
start up (in this case, after the root partition).
At this point, unmount the partitions, and I suggest you check them
one last time before you reboot.
e2fsck -f /dev/sdb2
e2fsck -f /dev/sdb3
to complete the file system checks. Then reboot (a variety of methods).
At this point, your system should be up and running OK with the new
partitions. Please make a clarification request if you have ANY
problems with the steps described or if any step is unclear. I would
be glad to follow up as needed.
Good luck with your work.