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

Re: [partman] How to keep data in existing partitions

|--==> Anton Zinoviev writes:

  AZ> On Tue, Jan 10, 2006 at 06:34:44PM +0100, Free Ekanayaka wrote:
  >>Ok, by reading  through the partman manual  I figure out  more or less
  >>how  the  system work, and   how  could  I  use  the  commands of  the
  >>parted_server to  write a shell script  to decide whether to format or
  >>keep the data.

  AZ> Partman-auto is not designed to reuse existing partitions.  If you
  AZ> instruct it not to format the partition for /home then it will create
  AZ> a new partition for /home and it will try to use it without
  AZ> formatting.  This won't be a partition that already exists.

  >>But   still  I don't understand exactly   where  should I  install the
  >>script. I've seen that  partman-auto  installs items in various   menu
  >>directories. According to the manual the first one to bu run should be
  >>the one in the choose_partition directory:

  AZ> I suppose the following will do the job.  First, a script at the end
  AZ> of init.d:

  AZ> if there_is_a_partition_for_/home; then
  AZ>    create a recipy for / and swap only

Here you can also  create a recipe including not  only / and swap, but
also  /home with *keep* method, so  that you  can avoid creating files
use_filesystem, filesystem etc. afterwards.

  AZ> else
  AZ>    create a recipy for /, /home and swap

Yes, this time with the *format* method for /home

  AZ> fi

  AZ> Second partman-auto autopartitions the free space of the disc acording
  AZ> to the new recipy.

  AZ> Third, a script at the start of finish.d:

  AZ> if a_recipy_without_/home_has_been_used; then
  AZ>    create files use_filesystem, filesystem and mountpoint in the \
  AZ>       partition directory of the partition for /home
  AZ> fi

Yes, it should work but  I ended up in writing  a simple script  which
generates a single recipe with "keep" or "format" for /home.

I've put the  script in a custom  udeb which I called partman-recipes,
which in the future could include other similar scripts to inspect the
hard disk  and generate recipes to handle  common situation  like mine
(you  could   choose which recipe   generator to  use  by preseeding a
debconf value).



Reply to: