02-19-2009
Shell script to make and mount a Partition
Hi,
I need to mount a new partition in a series of Pc that have a single hard drive of 20 GB; the used and partioned space amounts to 10 GB, between root, boot and swap; the script is to make the mounting process automatic
These are the contents of my script:
**********************************************
cd /
#gave the list of commands from the file "origin"
sbin/fdisk /dev/hda < origin
#read the partition table, format the new and give it a name "/data"
#partprobe doesn't work
#sfdisk /dev/hda -R doesn't work either
mkfs.ext3 /dev/hda4
e2label /dev/hda4 /data
#make a "/data" directory, and place it in fstab
mkdir /data
LINEA='/data /data ext3 defaults 1 1'
grep "$LINEA" /etc/fstab >/dev/null || echo $LINEA >> /etc/fstab
mount -a
**********************************************
And these are the contents of origin:
**************************************
n
e
1294
2434
w
**************************************
But here is where i'm having trouble, i can't seem to make the system re-read the partition table (doesn't have partprobe, and sfdisk /dev/hda -R doesn't work at all)
There is a way to make this script run at boot time, before it read the partition table, forcing it to make the changes? This script should run just once in every equip. I'm utterly lost here, i would appreciate any help in the solution.
I am new tho shell scripting and linux in general, perhaps this is not the right way to do what i want.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
I am trying to mount a FAT16 and FAT32 partition on an already installed Redhat system.
I have tried to edit the fstab and mtab, and to put in the data I got from fdisk, but it just says cannot find it.
The information given by fdisk on /dev/hda is:
Device Boot Start ... (4 Replies)
Discussion started by: ghoti
4 Replies
2. Solaris
Hello,
I have a problem on my sun station, that run solaris7.
To free temporarly a little space on /, I moved a few empty folders (mnt, net, awk, tftpboot) to the /home partition.
Unfortunately the system froze just after this...maybe I should not have move this files, I don't know, I am a... (3 Replies)
Discussion started by: nabulus
3 Replies
3. Solaris
dear all,
that is my problem :
c0d0p1 is nt,
c0d0p2 is solaris
and other on extended partition is pcfs,
so how can i mount it somewhere?
because i dont know which one connect from raw to block dev.
/dev/rdsk/c0d0p?
any help would be great... :) (6 Replies)
Discussion started by: stdout
6 Replies
4. UNIX for Dummies Questions & Answers
I've created a partition with GNU Parted, how do I mount the partition?
The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards.
Thanks,
--Todd (1 Reply)
Discussion started by: jtp51
1 Replies
5. Solaris
Dear Brothers
First i installed suse linux with the following partition. my hd0 size is 75gb
hdc1 swap 1 gb
hdc2 native linux 39gb
For the rest of the 35 gb i did not create any partition. so i planned to install solaris 10x86 on that free space.
When i installed the solaris i... (1 Reply)
Discussion started by: sayed_021
1 Replies
6. Shell Programming and Scripting
Hello all
How is it going
I want Shell Patch
The work of the following division of the disk
Can this
200 MB EXT3 /boot
20 Gb EXT3 /
10 GB Swap
End Of Space ( Linux LVM )
Found a similar script can be customized by you to be the work required
#!/bin/bash
VSIZE=200
fdisk /dev/hda... (1 Reply)
Discussion started by: x-zer0
1 Replies
7. UNIX for Dummies Questions & Answers
Hello,
Im new here, and may be my question is stupid, but...
Today I run PGP Desktop decript on my 2nd partition ( D:\ ) and when decript finish, I restart my PC.Now when I try to open D:\ its give me: D:\ is not accessable and I lose my files :(
So I load Linux live CD ( knoppix ) and try to... (1 Reply)
Discussion started by: mrowcp
1 Replies
8. Shell Programming and Scripting
As stated, I am looking into keeping my backup drive unmounted in normal windows use. Partly this is to address threats like cryptolocker. Since one of my backup drives is an internal drive, it will not likely afford any protection from such a threat. I am thinking of adding code to my rsync script... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
9. UNIX for Dummies Questions & Answers
I want to gain read/write access to a Windows 8 partition from a linux live cd. Prior to Windows 8, I used ntfs-3g to mount the partition from the command line.
The "Fdisk -l" command does not seem to be able to read efi partitions. There must be some new strategy for linux users. This is... (6 Replies)
Discussion started by: jamarsh
6 Replies
10. AIX
Hello, today i get some aix errors (can't lock files and strange things) then i umount FS to do a fsck but i get these errors
root@omega / > fsck -p /dev/fslv06
The current volume is: /dev/fslv06
Unable to read primary superblock.
Unable to read either superblock.
I readed on this page... (9 Replies)
Discussion started by: thorin666
9 Replies
LEARN ABOUT MINIX
repartit
REPARTITION(8) System Manager's Manual REPARTITION(8)
NAME
repartition - load a partition table
SYNOPSIS
repartition device [partition-file]
DESCRIPTION
Repartition uploads a new partition table for the partitions of device. The table is obtained from the first sector of partition-file if
given, device otherwise. Device may refer to the whole drive or a primary partition, depending on whether you want to upload a partition
or a subpartition table. The partitions will be truncated to fit within the enclosing device like the disk driver does, unless the numbers
are coming from partition-file.
EXAMPLES
repartition /dev/hd0
repartition /dev/hd4 /etc/hd4.table
Reload the partition table of drive 0 setting /dev/hd[1-4], and the subpartition table of /dev/hd4 setting /dev/hd4[a-d] using a file. The
latter may be useful if you need more than the 4 subpartitions a single Minix partition gives you.
DIAGNOSTICS
The new table is printed on standard output.
FILES
/dev/hd[0-9]
SEE ALSO
hd(4), part(8).
BUGS
The disk must be in use for the changes to stick. The partition table of an idle disk will be reloaded on the first open.
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
REPARTITION(8)