create filesystem on md - RAID device

Franz Waldmüller waldbauernbub at
Tue Jan 5 20:00:03 UTC 2010

Markus Schönhaber wrote:
> 05.01.2010 13:31, Franz Waldmüller:
>> Hi I got a question concerning the creation of a new filesystem on a 
>> raid1 device (let's call it /dev/md7).
>> I am running ubuntu 9.10 i386 desktop edition.
>> I just want some advice if my approach is correct:
>> if /dev/md7 is mounted as /home I intend to do the following (as root):
>> umount /home
>> mkfs.ext4 /dev/md7 # should I add any options?
>> then I have to correct the /etc/fstab file with the new UUID of the 
>> created filesystem
> Sounds good.
> Instead of changing the "UUID=..." part in fstab, you could use the
> device node, i. e. /dev/md7, as an alternative.
>> I run
>> blkid /dev/md7
>> And then I have to try to get this output into my fstab file. Any hints 
>> how I can do this on the command line without running X? I have some 
>> basic knowledge of using nano. Maybe I can run a command which attaches 
>> the output of blkid to the fstab file. The only thing left would be to 
>> move the UUID up to the right position in the fstab file
> You could do
> blkid /dev/md7 >> /etc/fstab
> you'll then have to manually remove the additional stuff blkid reports,
> or do something like
> blkid /dev/md7 | sed -r 's,.*(UUID=)"([^"]*)".*,\1\2,' >> /etc/fstab
> which should append only the UUID=... for the fs to /etc/fstab
I will copy this command to my useful-commands.txt file.
> Nevertheless, make a backup of your fstab before fiddling with it.
a backup is always a good idea :)

>> after
>> mount -a
>> everything should be up and running again?
>> Am I correct?
> Don't forget to copy the data in you old /home.
> Other than that, I don't see anything wrong with what you write.
Thank you for your advice.

More information about the ubuntu-users mailing list