0

I have an old hard drive with windows XP and I want to switch to Ubuntu 15.04 thus removing windows XP completely which is installed in C partition. My HDD is divided to 4 FAT32 partitions: C (9.30 GB) D (18.6 GB) E (18.6 GB) F (27.9 GB) So while installing Ubuntu image from CD: Choosing (Do something else.) then choosing the 9.30 GB (C) partition and finally delete it, thus windows XP will be deleted. Now by choosing the partition to install Ubuntu and convert it to ext4 from FAT32. Will the other partitions remain FAT32 or they will be ext4 ? and if they will be ext4 or they will remain FAT32, will the data be erased in the 2 cases ?

Joenn
  • 1
  • 1
  • "Ubuntu and convert it to ext4 from FAT32" That is NOT possible. You -format- it to ext4. "convert" would mean you keep the data (you can convert fat32 to ntfs for instance where you keep your data). What you want is possible BUT fat32 is an obsolete filesystem. You will be better off moving all your files to 1 partition as much as possible and format the empty ones to ext4 and then move it all over to that ext4 and format the other fat32's. – Rinzwind Oct 17 '15 at 19:15
  • "Will the other partitions remain FAT32 or they will be ext4 ? and if they will be ext4 or they will remain FAT32, will the data be erased in the 2 cases ?" Choose "something else" and make sure those partitions are NOT marked for formatting and are added to your system as fat32. If you pick any of the installation methods those probably will check for other operating systems and when there are none format it all. – Rinzwind Oct 17 '15 at 19:16

2 Answers2

2

Now by choosing the partition to install Ubuntu and convert it to ext4 from FAT32.

Converting is not the correct word; it will delete anything on it and format that partition. Changing the formatting it is currently on to another will always delete the file (when using the installer). Converting is a method where you use a tool to change the formatting from one to another while keeping the data (Windows has a FAT32 to NTFS tool; gparted has a convert tool too.).

Will the other partitions remain FAT32 or they will be ext4 ?

Depends on what you tell the installer to do: if you pick "use whole disk" or "replace ... with ..." those will be deleted too. "something else" is the only one that does not delete them itself but you need to mark these partitions to be deleted. If you set these up as "use as FAT32 but do NOT format" those partitions will be added to the system with the mount point you supply.

and if they will be ext4 or they will remain FAT32, will the data be erased in the 2 cases ?

If set to ext4 those will be deleted.

A couple of things:

FAT32 is an obsolete format. Best to do is to use Windows to convert them to NTFS first before setting up Ubuntu.

If you keep these disks it is far better to keep Windows and use a dual boot. You can keep Windows by using a tool like gparted or partition manager to shrink Windows C: as much as possible.

The best option: put your files onto dvd's, ie. make backups and set those partitions up as ext4 if you plan to dump Windows completely.

Rinzwind
  • 299,756
1

In my experience, modifying the file system on one partition should have no impact on any other partition. The only way that modifying a partition will affect other partitions is if it's an extended partition. Primary partitions are unaffected by processes performed on other primary partitions. As an example, performing an operation on /dev/sdb2 will have an impact on /dev/sdb5 which is for all intents and purposes a child of /dev/sdb2 as shown in the partition table below.

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   113942527    56970240   83  Linux
/dev/sdb2       113942528   115939327      998400    5  Extended
/dev/sdb5       113944576   115939327      997376   82  Linux swap / 

Solaris

Conversely in the partition table below, all the partitions are primary so wiping out (formatting/deleting) /dev/sda1 will have the result of elimination of the Windows Boot partition but the data in /dev/sda2 and /dev/sda3 will remain unaffected.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      272383      135168    7  HPFS/NTFS/exFAT
/dev/sda2          287280   107412479    53562600    7  HPFS/NTFS/exFAT
/dev/sda3       107415552  1953523054   923053751+  83  Linux

It's always best to make a backup of any critical data before modifying a partition structure. Since I'll be modifying /dev/sda1 I'll make a backup first in a target directory (in this case I'll make an image in my /home which in my case is mounted on a different partition.

cd *<target directory>* where is on a drive or partition which will not be modified followed by sudo dc3dd if=/dev/sda1 of=winboot.img

Output is as follows:

dc3dd 7.1.614 started at 2015-10-17 11:07:53 -0500
compiled options:
command line: dc3dd if=/dev/sda1 of=winboot.img
device size: 270336 sectors (probed)
sector size: 512 bytes (probed)
138412032 bytes (132 M) copied (100%), 3.71078 s, 36 M/s                      

input results for device `/dev/sda1':
   270336 sectors in
   0 bad sectors replaced by zeros

output results for file `winboot.img':
   270336 sectors out

dc3dd completed at 2015-10-17 11:07:57 -0500

tvbox@tvbox-G31M-ES2L:/home$ 

Now I can do whatever I want with /dev/sda1 and if I have unintended consequences I can return it to it's previous state if I desire as I have both the start and end blocks from the partition table (listed above) and the content stored int he file winboot.img stored elsewhere. Here you can see that I've deleted /dev/sda1 from the partition table with gparted

deleted-sda1

If I want it back I can simply replace it by reversing the process. Here's the status of the partition table as it is via the p (print) command in fdisk.

sudo fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953523055 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x490756c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda2          287280   107412479    53562600    7  HPFS/NTFS/exFAT
/dev/sda3       107415552  1953523054   923053751+  83  Linux

Now I'll create a new primary partition #1 of the exact size used previously to replace the the one I deleted using the values from the previous fdisk table with the n (new) command:

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-1953523054, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-287279, default 287279): 272383

Finally I'll write the changes to disk as follows: 

    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 or after you run partprobe(8) or kpartx(8)
    Syncing disks.

Ok, warning, no problem. Issuing the command `partprobe

tvbox@tvbox-G31M-ES2L:/home$ partprobe

And checking my work.

$ sudo fdisk /dev/sda

tvbox@tvbox-G31M-ES2L:/home$ sudo fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953523055 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x490756c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      272383      135168   83  Linux
/dev/sda2          287280   107412479    53562600    7  HPFS/NTFS/exFAT
/dev/sda3       107415552  1953523054   923053751+  83  Linux

You'll note that /dev/sda1 has the default filesystem and isnt NTFS at the moment, as rewriting the image to the partition won't update the filesystem ID, we will simply format it NTFS first we can do this easily with gparted by right clicking on sda1 and choosing format to ntfs. we will also set the boot flag under manage flags while we are here.

Now I will re-apply the image with sudo dc3dd if=winboot.img of=/dev/sda1

Output:

dc3dd 7.1.614 started at 2015-10-17 11:52:49 -0500
compiled options:
command line: dc3dd if=winboot.img of=/dev/sda1
sector size: 512 bytes (assumed)
138412032 bytes (132 M) copied (100%), 3.20886 s, 41 M/s                      

input results for file `winboot.img':
   270336 sectors in

output results for file `/dev/sda1':
   270336 sectors out

dc3dd completed at 2015-10-17 11:52:53 -0500
In closing, If you do as you suggests and install only on the 9.30GB partition as you intend, the other partitions will be unaffected and will remain FAT32.

Thanks to this little exercise I've booted Windows on this system for the first time this year. It seems I can live without it. ;-)

readded-sda1

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Pilot6 Oct 12 '15 at 19:40
  • 1
    @Pilot6 Did I misread it? "Will the other partitions remain FAT32 or they will be ext4 ? and if they will be ext4 or they will remain FAT32, will the data be erased in the 2 cases ?" Clearly it answers the question posed. Granted Rinzwind answer is more fully formed. If the OP does as he suggests and installs only on the 9.30GB partition as intended, the other partitions will be unaffected and will remain FAT32. Is your experience otherwise? – Elder Geek Oct 13 '15 at 00:06
  • ElderGeek: Your comment is larger then the answer! :D And that is why you're showing up in the low quality review queue with all of us set to mode: must-delete-one-liners! ;-) (Voted to keep open as the answer is correct, but I would have reacted the same way as @Pilot6 if I would have been the first one and wouldn't have had the knowledge of the comment... :P) – Fabby Oct 13 '15 at 21:23
  • @Fabby , OK, I'll be verbose ;-D – Elder Geek Oct 17 '15 at 17:02
  • :D :D :D Upgoated! – Fabby Oct 17 '15 at 17:37