bug-parted
[Top][All Lists]
Advanced

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

resize + cp -> wrong size + request for help


From: Ross Boylan
Subject: resize + cp -> wrong size + request for help
Date: Thu, 29 Nov 2001 11:50:37 -0800
User-agent: Mutt/1.3.23i

I had an existing partition /hdc6, 2.80 GB.
I used parted to resize it to roughly 6.64 G by extending the end.
Then I did a cp from another partition (hda6) to the new one.

After a reboot, my new partition shows as the same size as the old
one, as seen in this df output:
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdc6              3692384   3160408    381932  90% /usr/local/src
/dev/hda9              3692384   3160632    381708  90% /usr

However, the partition table shows it's the new size:
Disk geometry for /dev/hdc: 0.000-29311.734 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031    800.112  primary   FAT         boot
2        800.143   4800.673  primary   FAT
3       4800.674  29306.074  extended              lba
9       4800.705   5067.377  logical   ext2
10      5067.409   5192.885  logical   linux-swap
5       5192.917   7397.116  logical   ntfs
6       8503.185  15296.264  logical   ext2
7      15296.295  19296.826  logical   ntfs
8      19296.857  29306.074  logical   ntfs

or, fdisk -l
Disk /dev/hdc: 255 heads, 63 sectors, 3736 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1   *         1       102    819283+   6  FAT16
/dev/hdc2           103       612   4096543+   b  Win95 FAT32
/dev/hdc3           613      3736  25093530    f  Win95 Ext'd (LBA)
/dev/hdc5           663       943   2257101    7  HPFS/NTFS
/dev/hdc6          1085      1950   6956113+  83  Linux
/dev/hdc7          1951      2460   4096543+   7  HPFS/NTFS
/dev/hdc8          2461      3736  10249438+   7  HPFS/NTFS
/dev/hdc9           613       646    273073+  83  Linux
/dev/hdc10          647       662    128488+  82  Linux swap


1) This seems like a bug.  It may be significant that /hdc6 showed as
ext3 on one diagnostic before I did anything.  Also, I ran e2fsck in
the middle of things--maybe it fixed the wrong size?

2) What's the best way to fix this?

3) Is there any way to recover the contents of /hdc6 before the cp?
(This is my real reason for asking 2; otherwise I assume I could just
reformat the partition and recopy, since I've switched back to my old
partitions when I saw this happened).

4) Consider changing the name of the cp command to replace or
something similar.  I thought it was going to add to the files that
were already on the partition, not replace them.  Though the behavior
is documented in the manual (too bad I didn't read it!) it is
unexpected behavior for cp.  (I know there's an argument that a
partition level cp should behave exactly as it did, but it's easy to
reason from the file level cp that preserves files).  Also, other
partition utilities do copies by regular file copy, and I assumed that
was what was going on here.

5) I'm not sure what would have happened if I specified a different
start than the existing one (given the warning parted can't move the
start) or an end past the legal reason.  I hope that's safe.
Megabytes are not natural units for this problem, and it would be nice
to add the ability to specify postion by other means (cylinder, CHS,
sector) and also to have a separate command extend that only moves the
end.  Also, some default behavior to fill available space would be
nice.  I know it's easier to wish for these things than do them :)



I am running debian woody on a 2.4.12 kernel.  The drives are Maxtor
EIDE, hda is UDMA-33 (13 G); hdc is UDMA-66 (30G).  AMD Athlon chip.

The partitions are in rough shape on hdc; I used Partition Magic and
it moved things off a cylinder boundaries and I had to manually
reconstruct the extended partition.


For your reference, here is the log of my activities.  The second
section has the parted part:

-----------------partition001.log-----------------------------
Script started on Thu Nov 29 09:06:06 2001
wheat:/usr/local/rootlog# date
Thu Nov 29 09:06:07 PST 2001
wheat:/usr/local/rootlog# fdisk /dev/hdc
#deleted some manipulations that I didn't write to disk
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): t
Partition number (1-10): 10
Hex code (type L to list codes): l

 0  Empty           1c  Hidden Win95 FA 65  Novell Netware  bb  Boot Wizard hid
 1  FAT12           1e  Hidden Win95 FA 70  DiskSecure Mult c1  DRDOS/sec (FAT-
 2  XENIX root      24  NEC DOS         75  PC/IX           c4  DRDOS/sec (FAT-
 3  XENIX usr       39  Plan 9          80  Old Minix       c6  DRDOS/sec (FAT-
 4  FAT16 <32M      3c  PartitionMagic  81  Minix / old Lin c7  Syrinx         
 5  Extended        40  Venix 80286     82  Linux swap      da  Non-FS data    
 6  FAT16           41  PPC PReP Boot   83  Linux           db  CP/M / CTOS / .
 7  HPFS/NTFS       42  SFS             84  OS/2 hidden C:  de  Dell Utility   
 8  AIX             4d  QNX4.x          85  Linux extended  df  BootIt         
 9  AIX bootable    4e  QNX4.x 2nd part 86  NTFS volume set e1  DOS access     
 a  OS/2 Boot Manag 4f  QNX4.x 3rd part 87  NTFS volume set e3  DOS R/O        
 b  Win95 FAT32     50  OnTrack DM      8e  Linux LVM       e4  SpeedStor      
 c  Win95 FAT32 (LB 51  OnTrack DM6 Aux 93  Amoeba          eb  BeOS fs        
 e  Win95 FAT16 (LB 52  CP/M            94  Amoeba BBT      ee  EFI GPT        
 f  Win95 Ext'd (LB 53  OnTrack DM6 Aux 9f  BSD/OS          ef  EFI (FAT-12/16/
10  OPUS            54  OnTrackDM6      a0  IBM Thinkpad hi f0  Linux/PA-RISC b
11  Hidden FAT12    55  EZ-Drive        a5  FreeBSD         f1  SpeedStor      
12  Compaq diagnost 56  Golden Bow      a6  OpenBSD         f4  SpeedStor      
14  Hidden FAT16 <3 5c  Priam Edisk     a7  NeXTSTEP        f2  DOS secondary  
16  Hidden FAT16    61  SpeedStor       a9  NetBSD          fd  Linux raid auto
17  Hidden HPFS/NTF 63  GNU HURD or Sys b7  BSDI fs         fe  LANstep        
18  AST SmartSleep  64  Novell Netware  b8  BSDI swap       ff  BBT            
1b  Hidden Win95 FA
Hex code (type L to list codes): 82
Changed system type of partition 10 to 82 (Linux swap)

Command (m for help): q

wheat:/usr/local/rootlog# mke2fs /dev/hdc9
mke2fs 1.25 (20-Sep-2001)
mke2fs: Device size reported to be zero.  Invalid partition specified, or
        partition table wasn't reread after running fdisk, due to
        a modified partition being busy and in use.  You may need to reboot
        to re-read your partition table.

wheat:/usr/local/rootlog# fdisk /dev/hdc

The number of cylinders for this disk is set to 3736.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hdc: 255 heads, 63 sectors, 3736 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1       102    819283+   6  FAT16
/dev/hdc2           103       612   4096543+   b  Win95 FAT32
/dev/hdc3           613      3736  25093530    f  Win95 Ext'd (LBA)
/dev/hdc5           663       943   2257101    7  HPFS/NTFS
/dev/hdc6          1085      1449   2931831   83  Linux
/dev/hdc7          1951      2460   4096543+   7  HPFS/NTFS
/dev/hdc8          2461      3736  10249438+   7  HPFS/NTFS

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (613-3736, default 613): 
Using default value 613
Last cylinder or +size or +sizeM or +sizeK (613-662, default 662): +265M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (647-3736, default 647): 
Using default value 647
Last cylinder or +size or +sizeM or +sizeK (647-662, default 662): 
Using default value 662

Command (m for help): t
Partition number (1-10): 10
Hex code (type L to list codes): 82
Changed system type of partition 10 to 82 (Linux swap)

Command (m for help): w p

Disk /dev/hdc: 255 heads, 63 sectors, 3736 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1       102    819283+   6  FAT16
/dev/hdc2           103       612   4096543+   b  Win95 FAT32
/dev/hdc3           613      3736  25093530    f  Win95 Ext'd (LBA)
/dev/hdc5           663       943   2257101    7  HPFS/NTFS
/dev/hdc6          1085      1449   2931831   83  Linux
/dev/hdc7          1951      2460   4096543+   7  HPFS/NTFS
/dev/hdc8          2461      3736  10249438+   7  HPFS/NTFS
/dev/hdc9           613       646    273073+  83  Linux
/dev/hdc10          647       662    128488+  82  Linux swap

Partition table entries are not in disk order

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or 
resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
wheat:/usr/local/rootlog# mke2fs /dev/hdc9
mke2fs 1.25 (20-Sep-2001)
mke2fs: Device size reported to be zero.  Invalid partition specified, or
        partition table wasn't reread after running fdisk, due to
        a modified partition being busy and in use.  You may need to reboot
        to re-read your partition table.

wheat:/usr/local/rootlog# fdisk -l /dev/hdc

Disk /dev/hdc: 255 heads, 63 sectors, 3736 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1       102    819283+   6  FAT16
/dev/hdc2           103       612   4096543+   b  Win95 FAT32
/dev/hdc3           613      3736  25093530    f  Win95 Ext'd (LBA)
/dev/hdc5           663       943   2257101    7  HPFS/NTFS
/dev/hdc6          1085      1449   2931831   83  Linux
/dev/hdc7          1951      2460   4096543+   7  HPFS/NTFS
/dev/hdc8          2461      3736  10249438+   7  HPFS/NTFS
/dev/hdc9           613       646    273073+  83  Linux
/dev/hdc10          647       662    128488+  82  Linux swap

Partition table entries are not in disk order
wheat:/usr/local/rootlog# exit
exit

Script done on Thu Nov 29 09:21:59 2001

------------------------- partition002.log----------------------------
# rebooted first
Script started on Thu Nov 29 09:38:43 2001
wheat:/usr/local/rootlog# date
Thu Nov 29 09:38:44 PST 2001
wheat:/usr/local/rootlog# mke2fs /dev/hdc9
mke2fs 1.25 (20-Sep-2001)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
68272 inodes, 273073 blocks
13653 blocks (5.00%) reserved for the super user
First data block=1
34 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185

Writing inode tables:  0/34 1/34 2/34 3/34 4/34 
5/34 6/34 7/34 8/34 
9/3410/3411/3412/3413/3414/3415/3416/3417/3418/3419/3420/3421/3422/3423/3424/3425/3426/3427/3428/3429/3430/3431/3432/3433/34done
                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
wheat:/usr/local/rootlog# mkswap -f /dev/hdc10
Setting up swapspace version 1, size = 131567616 bytes
wheat:/usr/local/rootlog# gpart
Usage: gpart [options] device
Options: [-b <backup MBR>][-C c,h,s][-c][-d][-E][-e][-f][-g][-h][-i]
         [-K <last sector>][-k <# of sectors>][-L][-l <log file>]
         [-n <increment>][-q][-s <sector-size>][-t <module-name>]
         [-V][-v][-W <device>][-w <module-name,weight>]
gpart v0.1h (c) 1999-2001 Michail Brzitwa <address@hidden>.
Guess PC-type hard disk partitions.

wheat:/usr/local/rootlog# gpart /dev/hdc

Begin scan...
Possible partition(DOS FAT), size(800mb), offset(0mb)
Possible partition(DOS FAT), size(4000mb), offset(800mb)
Possible extended partition at offset(4800mb)
   Possible partition(Linux ext2), size(266mb), offset(4800mb)
   Possible partition(Linux swap), size(125mb), offset(5067mb)
Possible extended partition at offset(5192mb)
   Possible partition(Windows NT/W2K FS), size(2204mb), offset(5192mb)
   Possible partition(Linux ext2), size(2863mb), offset(8503mb)
   Possible partition(Windows NT/W2K FS), size(4000mb), offset(15296mb)
   Possible partition(Windows NT/W2K FS), size(10009mb), offset(19296mb)
End scan.

Checking partitions...

* Warning: more than one extended partition: 5.
Partition(Primary 'big' DOS (> 32MB)): primary 
Partition(DOS or Windows 95 with 32 bit FAT, LBA): primary 
   Partition(Linux ext2 filesystem): invalid logical 
   Partition(Linux swap or Solaris/x86): orphaned logical 
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): invalid 
Partition(Linux ext2 filesystem): invalid 
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): invalid 
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): invalid 
Ok.

Guessed primary partition table:
Primary partition(1)
   type: 006(0x06)(Primary 'big' DOS (> 32MB))
   size: 800mb #s(1638567) s(63-1638629)
   chs:  (0/1/1)-(101/254/63)d (0/1/1)-(101/254/63)r

Primary partition(2)
   type: 012(0x0C)(DOS or Windows 95 with 32 bit FAT, LBA)
   size: 4000mb #s(8193087) s(1638693-9831779)
   chs:  (102/1/1)-(611/254/63)d (102/1/1)-(611/254/63)r

Primary partition(3)
   type: 015(0x0F)(Extended DOS, LBA)
   size: 6565mb #s(13446405) s(9831780-23278184)
   chs:  (612/0/1)-(1023/254/63)d (612/0/1)-(1448/254/63)r

Primary partition(4)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

wheat:/usr/local/rootlog# parted /dev/hdc
GNU Parted 1.4.20
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See 
the GNU General Public License
for more details.

Using /dev/hdc
Warning: Unable to align partition properly.  This probably means that another 
partitioning tool generated an
incorrect partition table, because it didn't have the correct BIOS geometry.  
It is safe to ignore,but
ignoring may cause (fixable) problems with some boot loaders.
Ignore Cancel ? 
Ignore Cancel ? i
(parted) p
Disk geometry for /dev/hdc: 0.000-29311.734 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031    800.112  primary   FAT         
2        800.143   4800.673  primary   FAT         
3       4800.674  29306.074  extended              lba
9       4800.705   5067.377  logical   ext2        
10      5067.409   5192.885  logical   linux-swap  
5       5192.917   7397.116  logical   ntfs        
6       8503.185  11366.301  logical   ext3        
7      15296.295  19296.826  logical   ntfs        
8      19296.857  29306.074  logical   ntfs        
(parted) sel /dec/h   v/hda

Using /dev/hda
Warning: The operating system thinks the geometry on /dev/hda is 1653/255/63.  
Therefore, cylinder 1024 ends
at 8032.499M.  You have Windows FAT partition(s) that are not using LBA.  If 
your BIOS supports LBA, then you
should switch to LBA by setting the LBA flag on all FAT partitions.  Otherwise, 
make sure the operating system
and the BIOS have the same geometry before resizing any FAT partitions.
(parted) p
Disk geometry for /dev/hda: 0.000-12970.617 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031    502.031  primary   FAT         boot
2        502.031   1498.249  primary   FAT         
3       1498.250   2580.754  primary   FAT         
4       2580.754  12966.525  extended              
5       2580.785   2706.262  logical   linux-swap  
6       2706.293   2965.122  logical   ext2        
7       2965.153   6267.546  logical   ntfs        
8       6267.577   9303.266  logical   ntfs        
9       9303.297  12966.525  logical   ext2        
(parted) sel /dev/hdc

Using /dev/hdc
(parted) help resize
  resize MINOR START END        resize filesystem on partition MINOR

        MINOR is the partition number used by Linux.  On msdos disk labels, the 
primary partitions number from
        1-4, and logical partitions are 5 onwards.
        START and END are in megabytes
(parted) resize 6          set 1 boot on
(parted) resize 6  8503.185 15296.295  64
Warning: Partition is being used.
Ignore Cancel ? i
Warning: Filesystem was not cleanly unmounted!  You should e2fsck.
Ignore Cancel ? c
(parted) 
[1]+  Stopped                 parted /dev/hdc
wheat:/usr/local/rootlog# unom   mount /dev/hd      
usr/local/src
wheat:/usr/local/rootlog# fg
parted /dev/hdc
resize 6  8503.185 15296.264
(parted) p
Disk geometry for /dev/hdc: 0.000-29311.734 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031    800.112  primary   FAT         boot
2        800.143   4800.673  primary   FAT         
3       4800.674  29306.074  extended              lba
9       4800.705   5067.377  logical   ext2        
10      5067.409   5192.885  logical   linux-swap  
5       5192.917   7397.116  logical   ntfs        
6       8503.185  15296.264  logical   ext3        
7      15296.295  19296.826  logical   ntfs        
8      19296.857  29306.074  logical   ntfs        
(parted) check 6
Information: The ext2 filesystem passed a basic check.  For a more 
comprehensive check, use the e2fsck
program.
(parted) 
[1]+  Stopped                 parted /dev/hdc
wheat:/usr/local/rootlog# e2fsck /dev/hdc6
e2fsck 1.25 (20-Sep-2001)
The filesystem size (according to the superblock) is 1739028 blocks
The physical size of the device is 732957 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no

/dev/hdc6: clean, 98430/860544 files, 570276/1739028 blocks
wheat:/usr/local/rootlog# fg
parted /dev/hdc
cp /dev/hda 6 9
Warning: Filesystem was not cleanly unmounted!  You should e2fsck.
Ignore Cancel ? i
Warning: Filesystem was not cleanly unmounted!  You should e2fsck.
Ignore Cancel ? i
Error: Filesystem was not cleanly unmounted!  You should e2fsck.
(parted) cp /dev/hda 9 6
Warning: Filesystem was not cleanly unmounted!  You should e2fsck.
Ignore Cancel ? i
Warning: Filesystem was not cleanly unmounted!  You should e2fsck.
Ignore Cancel ? i
Error: Filesystem was not cleanly unmounted!  You should e2fsck.
(parted) q
Warning: The kernel was unable to re-read your partition table, so you need to 
reboot before mounting any
modified partitions.  You also need to reinstall your boot loader before you 
reboot (which may require
mounting modified partitions).  It is impossible do both things!  So you'll 
need to boot off a rescue disk,
and reinstall your boot loader from the rescue disk.  Read section 4 of the 
Parted User documentation for more
information.
wheat:/usr/local/rootlog# exit
exit

Script done on Thu Nov 29 10:13:27 2001



reply via email to

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