[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug(s) in parted info file

From: Ralph Shumaker
Subject: bug(s) in parted info file
Date: Mon, 08 Mar 2004 14:53:51 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.6) Gecko/20040113

(Reference page quoted at the bottom.)

Bug #1:
 1. Shrink the `/home' partition (`/dev/hda6') by 500MB:

Fix #1:
 1. Shrink the `/home' partition (`/dev/hda6') by 800MB:

Bug/Fix #2:
 After you shrink `/home', why don't you just:
    (parted) move 7 6200 7000 (since the dest>src)
    (parted) resize 7 6200 7326.5 (since the START is ok)
This would effectively eliminate the minor-number-shuffle and the subsequent 
need to modify `/etc/fstab'.

Or it's possible that I am just not completely understanding correctly `move' 
and `resize'.  I also recognize the possibility that you purposely took the 
hard way, just to show that route for anyone who may need it, like if they were 
only going to shrink `/home' by 10M.  Yes, such a small change may seem 
ridiculous, I know, but maybe someone would want it.  Such a small change would 
effectively prevent `resize 7 7067.7 7077.7' as well as `move 7 7057.7 7067.7'. 
 But then your long way would not work either.  Though you still could do this:
    (parted) resize 7 7067.7 7087.7   (7 only uses 12M)
    (parted) move 7 7087.7 7107.7     (freshly emptied)
    (parted) move 7 7057.7 7077.7     (freshly emptied)
    (parted) resize 7 6200 7326.5     (since START is ok)
Or am I still missing something?  I guess I just cannot imagine why anyone 
would need to do the minor-number-shuffle.  Between the descriptions of `move' 
and `resize' I did not see anything to indicate why anyone would need to do it. 
 (But I think it's still good that you show how to do it, just in case.)

   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.  (1)
1. Shrink the `/home' partition (`/dev/hda6') by 500MB: # parted /dev/hda
         (parted) resize 6 3545.6 6200
2. Make a new partition in its place. This is where `/var' will be,
    eventually.  This new partition will be numbered 10.
(parted) mkpartfs logical ext2 6200 7067.7 3. Copy the old `/var' partition (`/dev/hda7') to the new one
(parted) cp 7 10 4. Delete the old `/var'. (parted) rm 7 At 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.
5. Resize the new `/var' partition (now numbered 9), adding the space
    from the old `/var' partition:
(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.
6. Since the partition numbers have changed, `/etc/fstab' must be
    updated.  This can be done before rebooting, because the root
    device wasn't touched by Parted.  (If you want to use Parted to do
    something to the root device, you need to use the boot disk).
If the old `/etc/fstab' looks like this: /dev/hda8 / ext2 defaults 1 1
         /dev/hda1      /boot        ext2    defaults        1 2
         /dev/hda6      /home        ext2    grpquota,usrquota  0  2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]