bug-parted
[Top][All Lists]
Advanced

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

Re: unclear cp semantics nuked non-working drive?


From: Andrew Clausen
Subject: Re: unclear cp semantics nuked non-working drive?
Date: Sun, 26 Nov 2000 16:49:30 +1100

address@hidden wrote:
> Parted is a nice and friendly tool, but I managed to distroy a
> partition using CP with GNU Parted 1.2.13.

Ouch!

> I was working on partitioning my hda drive, and wanted to cp a
> partition: /dev/hdb1 to /dev/hda1.
> 
> Here's what I did:
> 
>     ~# parted /dev/hda
>     (parted) help cp
>       cp MINOR [DEVICE] MINOR       copy filesystem to another partition
> 
>             MINOR is the partition number used by Linux.  The primary 
> partitions
>             number from 1-4, and logical partitions are 5 onwards.
>             DEVICE is usually /dev/hda or /dev/sda
> 
> I wondered about the strange commandline for CP, why is only one
> DEVICE allowed?

Have a look at the "select" command...

> But I acknowledged that one device is enough; you
> only may need to specify another SOURCE device, as the destination
> device can clearly only be the one you're working on, ie, the one
> that was specified on the command line, in my case /dev/hda.
> 
> So, to copy /dev/hdb1 to /dev/hda1 I did:
> 
>     (parted) cp 1 /dev/hdb 1

Ouch.  You want:

        (parted) select /dev/hdb
        (parted) cp 1 /dev/hda 1

> but apparently, this copies /dev/hda1 to /dev/hdb1?

Correct.

> I have two strong suggestions:
> 
> * it would be good (IMO), if parted would refuse (or at least warn
> before) to write to a disk that is not the ``working disk''.

Well, if you say /dev/hdb, or whatever, you are explicitly telling
it to write to another disk...
 
> (or, at least change the CP help to:
> 
>    cp FROM-MINOR [TO-DEVICE] TO-MINOR

I like this idea.

> which reflects the current semantics.  But I think it's evil to
> write to a device that's not the working device...)

So, you think we should change it to:

        cp [FROM-DEVICE] FROM-MINOR TO-MINOR

Any votes on this matter?

Thanks,
Andrew Clausen



reply via email to

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