Páginas

sábado, 12 de noviembre de 2011

Mover usr a otra particion

Mover /usr a una partición independiente. Todo el proceso lo he realizado en un terminal desde gentoo.
Las etiquetas permiten la identificación de las particiones:

# tune2fs -L usr_gentoo /dev/sda8
tune2fs 1.41.14 (22-Dec-2010)

Sacando información del disco duro, hay varias maneras de conseguirlo:
# blkid
/dev/sda1: LABEL="boot" UUID="3bb6187d-1918-4512-96f3-2ed42fc50c19" TYPE="ext2"
/dev/sda2: LABEL="squeeze" UUID="33b01f6e-1e74-4225-84b5-a66c568b38aa" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda3: LABEL="gentoo" UUID="86fd2e13-119f-4efb-aedd-aa5ebd7c77a8" TYPE="ext4"
/dev/sda5: UUID="afa7c31e-c8bf-41f5-a340-78da2c230362" TYPE="swap"
/dev/sda6: LABEL="squeeze_home" UUID="cd3805eb-25b6-4ba4-b99e-7575407f05be" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda7: LABEL="data" UUID="1ddcb07d-b322-4039-837b-48f3daef1426" TYPE="ext3"
/dev/sda8: LABEL="usr_gentoo" UUID="18536501-37ee-4f40-a362-2d9173c43856" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda9: UUID="a7163b55-b4c6-4e31-bf2b-8aeb6a34bdca" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda10: LABEL="home_gentoo" UUID="bff4d21b-d8cb-422d-8c91-b35c4e43ffbf" TYPE="ext3"
/dev/sda11: LABEL="portage" UUID="a0c335fb-2c70-43d3-9138-ff638e360f36" TYPE="reiserfs"

# ls -l /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 Nov 12 18:54 boot -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 12 18:29 data -> ../../sda7
lrwxrwxrwx 1 root root 10 Nov 12 18:29 gentoo -> ../../sda3
lrwxrwxrwx 1 root root 11 Nov 12 18:29 home_gentoo -> ../../sda10
lrwxrwxrwx 1 root root 11 Nov 12 18:29 portage -> ../../sda11
lrwxrwxrwx 1 root root 10 Nov 12 18:54 squeeze -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 12 18:54 squeeze_home -> ../../sda6
lrwxrwxrwx 1 root root 10 Nov 12 18:36 usr_gentoo -> ../../sda8

# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0000bac9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      210943      104448   83  Linux
/dev/sda2          210944    51410943    25600000   83  Linux
/dev/sda3        51410944   112850943    30720000   83  Linux
/dev/sda4       112852990   976771071   431959041    5  Extended
Partition 4 does not start on physical sector boundary.
/dev/sda5       112855040   117049343     2097152   82  Linux swap / Solaris
/dev/sda6       117051392   137531391    10240000   83  Linux
/dev/sda7       137533440   485693439   174080000   83  Linux
/dev/sda8       485695488   527927295    21115904   83  Linux
/dev/sda9       527929344   550371327    11220992   83  Linux
/dev/sda10      550373376   574251007    11938816   83  Linux
/dev/sda11      574259553   606453749    16097098+  83  Linux
Partition 11 does not start on physical sector boundary.

# cd /
# mkdir usr_nuevo
# mount -v -t ext3 /dev/sda8 /usr_nuevo/
# rm -rf /usr_nuevo/*
# cp -dpR /usr/* /usr_nuevo/
# umount /usr_nuevo
# mv /usr /usr_antiguo
# mkdir /usr
# mount /dev/sda8 /usr
# mount -a

Agregar entrada a /etc/fstab:
# vi /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#
#                                          

 # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1     /boot          ext2       noauto              1 2
/dev/sda3     /              ext4       noatime             1 1
/dev/sda5     none           swap       sw                  0 0
/dev/sda8     /usr           ext3       auto,noatime        0 1
/dev/sda10    /home          ext3       defaults,noatime    0 2
/dev/sda11    /usr/portage   reiserfs   defaults           0 0
/dev/sda7     /media/data    ext3       defaults,noatime   0 0
/dev/cdrom    /mnt/cdrom     auto       noauto,ro           0 0
#/dev/fd0     /mnt/floppy    auto       noauto             0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
 shm          /dev/shm    tmpfs     nodev,nosuid,noexec     0 0


Comprobando:
# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
/dev/sda3 on / type ext4 (rw,noatime,commit=0)
rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda8 on /usr type ext3 (rw,noatime,commit=0)
/dev/sda10 on /home type ext3 (rw,noatime,commit=0)
/dev/sda11 on /usr/portage type reiserfs (rw)
/dev/sda7 on /media/data type ext3 (rw,noatime,commit=0)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)

Es el momento de reiniciar el sistema. He reiniciado y todo funciona perfectamente.
Puede borrar el directorio /usr_antiguo.
# rm -rf /usr_antiguo

Linux es genial!.

No hay comentarios:

Publicar un comentario