Moving the /Home Partition, Permission Issues.

Marius Gedminas marius at pov.lt
Wed Apr 28 18:59:10 UTC 2010


On Wed, Apr 28, 2010 at 01:29:09PM -0500, Tuxman wrote:
> I'm getting ready to install 10.4 (8.04 currently), and I need to 
> rearrange some partitions in preparation.
> 
> I need to move my /Home partition out of the way temporarily and the 
> only place I have to move it to is an NTFS drive that can't be changed. 
> I can handle all of the repartitioning with GParted without a problem, 
> but I'm weak when it comes to Linux file/folder permission issues.
> 
> Are there issues here?

You can't copy the files and folders directly to NTFS, since you'll lose
permission information.  Also, some of the filenames might be
incompatible (e.g. Linux allows : in filenames, NTFS doesn't).

A tar archive should be safe enough and would be my first choice:

  sudo -s
  cd /home
  tar -czf /media/windows-partition/home.tar.gz --one-file-system .

A direct filesystem image might be a bit faster, especially if you have
a lot of small files, and the partition is close to full:

  cd /
  sudo -s
  umount /home      # Never take an image of a mounted partition!
  dd if=/dev/sdaX of=/media/windows-partition/home.img bs=32k

however you need to make sure no programs are using /home, which means
logging out of GNOME and doing everything from a text console or via
SSH.  Also, by extracting a tar archive you're defragmenting the file
system as a side effect, and you can also switch filesystem types (ext3 to
ext4), which then get a chance to layout your files better for faster
access.  (I wouldn't expect huge performance gains, though.  Maybe for
dysfunctional cases like a single directory containing millions of
files.)

Now, restoring from a tar archive: create and format an empty partition
(one that is large enough), then make sure it's mounted and

  sudo -s
  cd /home
  tar -xzf /media/windows-partition/home.tar.gz

To restore a disk image, you'd need to create a partition of exactly
the same size (or larger), then swap the if and of arguments of dd:

  sudo -s
  umount /home         # safety check, it shouldn't have been mounted
                       # since it doesn't have a valid filesystem,
                       # but better safe than sorry
  dd if=/media/windows-partition/home.img of=/dev/sdaX bs=32k
  resize2fs /dev/sdaX  # Only if you made the new partition larger
  mount /home

> How do I do this safely?

Make backups!  Then even if something happens, you haven't lost your
data.

It helps a lot if you understand exactly what's happening instead of
blindly following instructions and typing commands.

> If you can point me to a guide, that would be great. The more 
> cookbookish the better.

I'd love to, if I knew any good links...

Have you tried searching on wiki.ubuntu.com?

Marius Gedminas
-- 
You can't spell evil without vi.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100428/f5da34a8/attachment.pgp>


More information about the ubuntu-users mailing list