Showing posts with label filesystem migration. Show all posts
Showing posts with label filesystem migration. Show all posts

Sunday, August 29, 2010

HDD partition plan

Intel X25M
sda1 - Windows 7 and WoW

320GB HDD1
sdb1 (30G) - Windows 7 User directory
sdb2 (30G) - Games
sdb5 (80G) - Linux LVM/RAID1 - don't touch
sdb6 (40G) - To convert into NTFS
sdb7 (10G) - RAID volume for Slackware root partition - don't touch
sdb8 (10G) - RAID volume for Ubuntu root partition - keep for now
sdb9 (120G) - Media

320GB HDD2
sdc1 (60G) - Data
sdc5/6/7/8 - same as sdb5-8
sdc9 (120G) - Backup

Wednesday, November 12, 2008

Removing a RAID partition

To remove a RAID device that consists of 2 partitions (sda7 and sdb7) that has an LVM2 VG on top:
- lvremove to remove all LVs
- vgremove to remove all VGs
- pvremove to remove all PVs
- mdadm --stop to stop the device
- mdadm --remove to remove the device
- mdadm --zero-superblock to erase the md superblock on each of the 2 partitions
- update /etc/mdadm.conf to remove the md device

Migrating /tmp to another partition

I decided to remove the 80G RAID-0 partition in my PC, and migrate the data inside to other LVM partitions. Currently, the partition has 1 LVM2 vg which contains 3 lvs. One of them contains files I downloaded and the other 2 are /tmp filesystems in my Slackware and Ubuntu installations respectively. I simply copied the files in the first lv to another lv (non-RAID LVM). For /tmp filesystems, I did the following steps for each of them:

- Create a new lv (RAID-1 LVM) of 4G. (lvcreate)
- Format it as reiserfs. (mkfs.reiserfs)
- Mount it to a temporary mount point.
- Copy files in /tmp over using rsync -av
- Go to single user mode and unmount /tmp
- Edit /etc/fstab to change /tmp to use the new lv.
- Remount /tmp and go into multi-user mode.

Note: the device to be put into fstab should be /dev/<vg>/<lv>, not /dev/mapper/<vg>-<lv>.