You are not logged in.

#1 2010-03-13 17:19:41

Zivs
Member
From: Riga/Dallas
Registered: 2009-11-01
Posts: 14

[Solved]Format from Ext2 to Ext4? And change /home mount place?

I have system on HDD, fstab configuration:

/dev/sda4 / ext4 defaults 0 1 #Arch instalation
/dev/sda5 swap swap defaults 0 0
/dev/sda2  /mnt/windows  ntfs-3g  users,uid=1000,gid=100,fmask=0113,dmask=0002  0 0  # just remain of Vista
/dev/sda6 /mnt/linux ext2 defaults 0 1  #left from old PCLinuxOS instalation

So - I would like to convert /dev/sda6 Ext2 to Ext4, and mount it as /home

I started like that:
su
umount /dev/sda6
................... but so how to convert Ext2 to Ext4?

Last edited by Zivs (2010-03-14 09:39:35)

Offline

#2 2010-03-13 17:44:22

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

mkfs.ext4 /dev/sda6

it will wipe the contents of that partition though so i'd backup first.


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#3 2010-03-13 17:52:14

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

You can backup all your files, then format ext2 to ext4. I don't think there is a direct way to do this.

Offline

#4 2010-03-13 18:09:33

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

You can mount it as an ext3 file system, then migrate it to ext4. In theory it can be done without data loss, but if you can spare the time I think it's best to back up and format, so you'll get the best performance.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2010-03-13 19:46:34

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

I think "tune2fs –O extents,dir_index,uninit_bg,has_journal /dev/<device>" followed by "fsck -fDC0 /dev/<device>" should do it in one step.  B is right about initial performance, but eventually most files will be converted to extents and it'll be basically just like a fresh ext4 fs.

Also I doubt those commands are safe to run on a mounted filesystem, although "tune2fs -j /dev/<device>" will get you safely to ext3.

Offline

#6 2010-03-13 21:13:36

Zivs
Member
From: Riga/Dallas
Registered: 2009-11-01
Posts: 14

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

Done, I just wiped off sda6 with mkfs.ext4 /dev/sda6, after backuping some importand files.
So last thing - how to mount sda6 as /home ? I alreadey have one /home on sda4 ?

And thanks that moved me to Nowbe corner smile

Last edited by Zivs (2010-03-13 21:33:20)

Offline

#7 2010-03-13 22:14:31

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

Boot with a live cd, mount your / and your new home partition, copy everything from the existing /home dir to the the new home partition.

Offline

#8 2010-03-14 04:25:21

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

And I'm guessing you already know this (I hope), but just for someone else reading this in the future, you need to change the ext2 to ext4 under /dev/sda6 in fstab smile

Offline

#9 2010-03-14 07:35:34

Zivs
Member
From: Riga/Dallas
Registered: 2009-11-01
Posts: 14

Re: [Solved]Format from Ext2 to Ext4? And change /home mount place?

I know. But I can not understand - what will happend with /dev/sda4 old  /home?  As I do not want risk - just ask you smile
-----------------------------------
Edit:

Ha, of couse there was a trick tongue
So my way:
boot from live CD, rename /home to /home2  # just for backup
then boot in root, change fstab: mount /dev/sda6 to /home
umount and the again mount /dev/sda6 as /home

umount /dev/sda6
mount /dev/sda6

and copied user file form /home2 to /home , without changing permisions (!!!) (if you copy just with cp command, you can not access user directory, you can log in root only)

[# cp -ax * /home2/eriks /home

When everything after reboot - delete /home2

Last edited by Zivs (2010-03-14 09:51:51)

Offline

Board footer

Powered by FluxBB