Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #164193

Re: changing partition names

From Frank McCormick <debianlist@videotron.ca>
Newsgroups linux.debian.user
Subject Re: changing partition names
Date 2016-02-15 18:00 +0100
Message-ID <r2uFc-3Dw-9@gated-at.bofh.it> (permalink)
References <r2bMe-7Rl-17@gated-at.bofh.it> <r2oT9-8aH-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15/02/16 05:49 AM, Jonathan Dowland wrote:
> On Sun, Feb 14, 2016 at 03:42:33PM -0500, Frank McCormick wrote:
>> I have deleted a partition from my HD containing a distro I no longer use.
>> As a result, my partitions on /dev/sda are numbered sda1. sda2 (windows) and
>> sda4. sda3 contained the distro I dumped.
>>
>> Can I just use fdisk or fsdisk to dump the existing partition record
>> edit the file to change sda4 to sda3 and then use fdisk or sfdisk to
>> read the file and create a properly named partition record ?
>
> If it's the names you are concerned about, then I would recommend not
> referencing partition numbers or device names directly if at all possible (e.g.
> sda3 or sdb). Instead label your filesystems (e2label /dev/sda3 MY_LABEL) and
> refer to the labels (/dev/disk/by-label/MY_LABEL) or use UUIDs. These are more
> robust against partition changes or disk renumberings.
>

   I already use UUIDS.

> If you want the space back, well, you can try to do some partition surgery but
> make sure you've got good backups first. For fresh setups I'd always recommend
> using LVM. If you were already using LVM, you could just reformat the unwanted
> partition as an LVM PV, add it to your VG and the space could be re-used,
> without having to muck with the partition table at all.
>

   I have the space back already. Maybe I didn't explain it clearly 
enough but I used Gparted to delete the partition and to enlarge the 
Debian partition. That's how I ended up with these mis-named 
partition...i.e. sda1 sda2 sda4.

> If you are mucking about with the partition tables, bear in mind that the table
> itself is like a bunch of pointers; so if you dump the table, edit it and
> re-load it, no data itself will have moved: so if the new table points at
> different places, you will have lost your filesystems. If you want sda4 to begin
> where sda3 used to be, you need to move the filesystem as well as rewrite the
> partition table.

   If I don't touch the beginning or ending of the partitions there 
should be no problem, right ?


This is probably something that (g)parted (or partition magic)
> can do, but here be dragons, etc.

   No neither can handle what I need...but apparently sfdisk can.

>
> If the now-spare sda3 was large enough, and you were not already using LVM, I'd
> recommend formatting sda3 as an LVM PV and create a new LVM VG, then an LVM LV;
> then migrate your data from sda4 into that LV; then format sda4 as an LVM PV and
> add that into the VG, so you end up with all the space being available, again
> without changing the partition table at all.
>

   Too late for LVM. Next time I reinstall from scratch, I'll take a 
look at it as it seems to make life more simple.



Thanks

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-14 21:50 +0100
  Re: changing partition names rlharris@oplink.net - 2016-02-14 23:10 +0100
    Re: changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-15 01:20 +0100
      Re: changing partition names Charlie Kravetz <cjk@teamcharliesangels.com> - 2016-02-15 03:00 +0100
        Re: changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-15 04:40 +0100
          Re: changing partition names Adam Wilson <moxalt@riseup.net> - 2016-02-16 07:50 +0100
  Re: changing partition names Felix Miata <mrmazda@earthlink.net> - 2016-02-15 02:00 +0100
    Re: changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-15 04:50 +0100
  Re: changing partition names Jonathan Dowland <jmtd@debian.org> - 2016-02-15 11:50 +0100
    Re: changing partition names <tomas@tuxteam.de> - 2016-02-15 12:50 +0100
    Re: changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-15 18:00 +0100
      Re: changing partition names jdd <jdd@dodin.org> - 2016-02-15 18:50 +0100
        Re: changing partition names Pascal Hambourg <pascal@plouf.fr.eu.org> - 2016-02-15 21:00 +0100
          Re: changing partition names Felix Miata <mrmazda@earthlink.net> - 2016-02-15 21:10 +0100
            Re: changing partition names Pascal Hambourg <pascal@plouf.fr.eu.org> - 2016-02-15 21:20 +0100
  Re: changing partition names Pascal Hambourg <pascal@plouf.fr.eu.org> - 2016-02-15 21:10 +0100
    Re: changing partition names Lisi Reisz <lisi.reisz@gmail.com> - 2016-02-16 00:20 +0100
      Re: changing partition names Felix Miata <mrmazda@earthlink.net> - 2016-02-16 00:40 +0100
        Re: changing partition names Frank McCormick <debianlist@videotron.ca> - 2016-02-16 01:30 +0100
          Re: changing partition names Felix Miata <mrmazda@earthlink.net> - 2016-02-16 04:40 +0100
        Re: changing partition names jdd <jdd@dodin.org> - 2016-02-16 08:50 +0100

csiph-web